dossier: don't display 'brouillon' in the timeline if not required

Unless the user is actually editing a brouillon, we don't need to show
this state.
This commit is contained in:
Pierre de La Morinerie 2018-09-17 15:21:47 +02:00
parent 530baf6ca6
commit ea3267c0d7
2 changed files with 5 additions and 4 deletions

View file

@ -1,8 +1,9 @@
.status-overview
- if !dossier.termine?
%ul.status-timeline
%li.brouillon{ class: dossier.brouillon? ? 'active' : nil }
brouillon
- if dossier.brouillon?
%li.brouillon{ class: dossier.brouillon? ? 'active' : nil }
brouillon
%li.en-construction{ class: dossier.en_construction? ? 'active' : nil }
en construction
%li.en-instruction{ class: dossier.en_instruction? ? 'active' : nil }

View file

@ -39,7 +39,7 @@ describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
let(:dossier) { create :dossier, :en_construction }
it 'renders the timeline (without the final states)' do
expect(rendered).to have_timeline_item('.brouillon').inactive
expect(rendered).not_to have_timeline_item('.brouillon')
expect(rendered).to have_timeline_item('.en-construction').active
expect(rendered).to have_timeline_item('.en-instruction').inactive
expect(rendered).to have_timeline_item('.termine').inactive
@ -52,7 +52,7 @@ describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
let(:dossier) { create :dossier, :en_instruction }
it 'renders the timeline (without the final states)' do
expect(rendered).to have_timeline_item('.brouillon').inactive
expect(rendered).not_to have_timeline_item('.brouillon')
expect(rendered).to have_timeline_item('.en-construction').inactive
expect(rendered).to have_timeline_item('.en-instruction').active
expect(rendered).to have_timeline_item('.termine').inactive