2022-07-20 18:53:40 +02:00
|
|
|
class Procedure::Card::ChampsComponent < ApplicationComponent
|
|
|
|
def initialize(procedure:)
|
|
|
|
@procedure = procedure
|
|
|
|
@count = @procedure.draft_revision.types_de_champ.public_only.size
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def render?
|
|
|
|
!@procedure.locked? || @procedure.feature_enabled?(:procedure_revisions)
|
|
|
|
end
|
|
|
|
|
|
|
|
def error_messages
|
2022-11-02 10:03:10 +01:00
|
|
|
[
|
2022-11-16 12:46:33 +01:00
|
|
|
@procedure.errors.messages_for(:draft_types_de_champ_public),
|
2022-11-02 10:03:10 +01:00
|
|
|
@procedure.errors.messages_for(:draft_revision)
|
|
|
|
].flatten.to_sentence
|
2022-07-20 18:53:40 +02:00
|
|
|
end
|
|
|
|
end
|