From 9dfbeed140591b111126281eddda4a6da8f5e2cc Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 10 Jan 2019 14:25:33 +0100 Subject: [PATCH] Moves draft and final result publication dates from tabs to sidebar --- .../legislation/processes/_header.html.erb | 24 ++++++++++++++++ .../legislation/processes/_key_dates.html.erb | 18 ------------ spec/features/legislation/processes_spec.rb | 28 +++++++++++++++++-- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/app/views/legislation/processes/_header.html.erb b/app/views/legislation/processes/_header.html.erb index 2c3eb22b1..4c6acea90 100644 --- a/app/views/legislation/processes/_header.html.erb +++ b/app/views/legislation/processes/_header.html.erb @@ -34,6 +34,30 @@ url: legislation_process_url(@process), description: @process.title } %> + + <% if process.draft_publication.enabled? %> + + +

+ <%= link_to draft_publication_legislation_process_path(@process) do %> + <%= format_date(process.draft_publication_date) %> + <% end %> +

+ <% end %> + + <% if process.result_publication.enabled? %> + + +

+ <%= link_to result_publication_legislation_process_path(@process) do %> + <%= format_date(process.result_publication_date) %> + <% end %> +

+ <% end %> diff --git a/app/views/legislation/processes/_key_dates.html.erb b/app/views/legislation/processes/_key_dates.html.erb index b10fdb32c..835aeff34 100644 --- a/app/views/legislation/processes/_key_dates.html.erb +++ b/app/views/legislation/processes/_key_dates.html.erb @@ -33,15 +33,6 @@ <% end %> - <% if process.draft_publication.enabled? %> -
  • > - <%= link_to draft_publication_legislation_process_path(process) do %> -

    <%= t("legislation.processes.shared.draft_publication_date") %>

    - <%= format_date(process.draft_publication_date) %> - <% end %> -
  • - <% end %> - <% if process.allegations_phase.enabled? %>
  • > <%= link_to allegations_legislation_process_path(process) do %> @@ -51,15 +42,6 @@
  • <% end %> - <% if process.result_publication.enabled? %> -
  • > - <%= link_to result_publication_legislation_process_path(process) do %> -

    <%= t("legislation.processes.shared.result_publication_date") %>

    - <%= format_date(process.result_publication_date) %> - <% end %> -
  • - <% end %> - <% if process.milestones.any? %>
  • "> <%= link_to milestones_legislation_process_path(process) do %> diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb index 3379e53fc..7d8157f37 100644 --- a/spec/features/legislation/processes_spec.rb +++ b/spec/features/legislation/processes_spec.rb @@ -152,8 +152,7 @@ feature 'Legislation' do scenario 'show view has document present on all phases' do process = create(:legislation_process) document = create(:document, documentable: process) - phases = ["Debate", "Proposals", "Draft publication", - "Comments", "Final result publication"] + phases = ["Debate", "Proposals", "Comments"] visit legislation_process_path(process) @@ -166,6 +165,31 @@ feature 'Legislation' do end end + scenario 'show draft publication and final result publication dates' do + process = create(:legislation_process, draft_publication_date: Date.new(2019, 01, 10), + result_publication_date: Date.new(2019, 01, 20)) + + visit legislation_process_path(process) + + within("aside") do + expect(page).to have_content("Draft publication") + expect(page).to have_content("10 Jan 2019") + expect(page).to have_content("Final result publication") + expect(page).to have_content("20 Jan 2019") + end + end + + scenario 'do not show draft publication and final result publication dates if are empty' do + process = create(:legislation_process, :empty) + + visit legislation_process_path(process) + + within("aside") do + expect(page).not_to have_content("Draft publication") + expect(page).not_to have_content("Final result publication") + end + end + scenario 'show additional info button' do process = create(:legislation_process, additional_info: "Text for additional info of the process")