demarches-normaliennes/app/components/procedure_draft_warning_component.rb
2024-07-08 11:32:37 +02:00

21 lines
563 B
Ruby

# frozen_string_literal: true
class ProcedureDraftWarningComponent < ApplicationComponent
attr_reader :revision
attr_reader :current_administrateur
attr_reader :extra_class_names
def initialize(revision:, current_administrateur:, extra_class_names: nil)
@revision = revision
@current_administrateur = current_administrateur
@extra_class_names = extra_class_names
end
def render?
revision.draft?
end
def admin?
current_administrateur.present? && revision.procedure.administrateurs.include?(current_administrateur)
end
end