diff --git a/app/components/procedure/card/chorus_component.rb b/app/components/procedure/card/chorus_component.rb new file mode 100644 index 000000000..e4830ce70 --- /dev/null +++ b/app/components/procedure/card/chorus_component.rb @@ -0,0 +1,13 @@ +class Procedure::Card::ChorusComponent < ApplicationComponent + def initialize(procedure:) + @procedure = procedure + end + + def render? + @procedure.chorusable? + end + + def error_messages + [] + end +end diff --git a/app/components/procedure/card/chorus_component/chorus_component.html.haml b/app/components/procedure/card/chorus_component/chorus_component.html.haml new file mode 100644 index 000000000..7f85ec850 --- /dev/null +++ b/app/components/procedure/card/chorus_component/chorus_component.html.haml @@ -0,0 +1,20 @@ +.fr-col-6.fr-col-md-4.fr-col-lg-3.chorus-component + = link_to edit_admin_procedure_chorus_path(@procedure), class: 'fr-tile fr-enlarge-link', title: error_messages do + .fr-tile__body.flex.column.align-center.justify-between + - if error_messages.present? + %div + %span.icon.refuse + %p.fr-tile-status-error À modifier + - elsif @count == 0 + %div + %span.icon.clock + %p.fr-tile-status-todo À compléter + - else + %div + %span.icon.accept + %p.fr-tile-status-accept Configuré + %div + %h3.fr-h6.fr-mt-10v + Connecteur Chorus + %p.fr-tile-subtitle Vous traitez des données de subvention d'état ? + %p.fr-btn.fr-btn--tertiary Configurer diff --git a/app/views/administrateurs/procedures/show.html.haml b/app/views/administrateurs/procedures/show.html.haml index bb4ad9d22..0df9bb013 100644 --- a/app/views/administrateurs/procedures/show.html.haml +++ b/app/views/administrateurs/procedures/show.html.haml @@ -66,3 +66,4 @@ = render Procedure::Card::SVASVRComponent.new(procedure: @procedure) if @procedure.sva_svr_enabled? || @procedure.feature_enabled?(:sva) = render Procedure::Card::MonAvisComponent.new(procedure: @procedure) = render Procedure::Card::DossierSubmittedMessageComponent.new(procedure: @procedure) + = render Procedure::Card::ChorusComponent.new(procedure: @procedure) diff --git a/spec/components/procedures/card/chorus_component_spec.rb b/spec/components/procedures/card/chorus_component_spec.rb new file mode 100644 index 000000000..b5148c376 --- /dev/null +++ b/spec/components/procedures/card/chorus_component_spec.rb @@ -0,0 +1,24 @@ +describe Procedure::Card::ChorusComponent, type: :component do + describe 'render' do + let(:procedure) { create(:procedure) } + + subject do + render_inline(described_class.new(procedure: procedure)) + end + + context 'feature flag not active' do + it 'does not render' do + subject + expect(page).not_to have_text('Connecteur Chorus') + end + end + context 'feature flag active' do + before { Flipper.enable_actor :chorus, procedure } + + it 'render the template' do + subject + expect(page).to have_text('Connecteur Chorus') + end + end + end +end