demarches-normaliennes/app/components/dossiers/edit_footer_component.rb
Paul Chavard c521724cf4 Update app/components/dossiers/edit_footer_component.rb
Co-authored-by: Colin Darie <colin@darie.eu>
2023-03-14 15:22:13 +01:00

29 lines
544 B
Ruby

class Dossiers::EditFooterComponent < ApplicationComponent
def initialize(dossier:, annotation:)
@dossier = dossier
@annotation = annotation
end
private
def owner?
controller.current_user.owns?(@dossier)
end
def annotation?
@annotation.present?
end
def button_options
{
class: 'fr-btn fr-btn--sm',
disabled: !owner?,
method: :post,
data: { 'disable-with': t('.submitting'), controller: 'autosave-submit' }
}
end
def render?
!@dossier.for_procedure_preview?
end
end