amelioration(procedure.chorus): ajoute la tuile chorus quand cette fonction est active sur la procedure
This commit is contained in:
parent
758b739aa3
commit
7d7a741a1a
4 changed files with 58 additions and 0 deletions
13
app/components/procedure/card/chorus_component.rb
Normal file
13
app/components/procedure/card/chorus_component.rb
Normal file
|
@ -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
|
|
@ -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
|
|
@ -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)
|
||||
|
|
24
spec/components/procedures/card/chorus_component_spec.rb
Normal file
24
spec/components/procedures/card/chorus_component_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue