diff --git a/app/assets/stylesheets/legislation_process.scss b/app/assets/stylesheets/legislation_process.scss index 0bfff8b23..990581236 100644 --- a/app/assets/stylesheets/legislation_process.scss +++ b/app/assets/stylesheets/legislation_process.scss @@ -44,68 +44,99 @@ // 02. Legislation process navigation // ---------------------------------- -.legislation-process-categories { - position: relative; +.legislation-process-list { + border-bottom: 1px solid $border; +} - .legislation-process-list { - border-bottom: 1px solid $medium-gray; - margin: 0 rem-calc(16) rem-calc(16); +.key-dates { + list-style-type: none; + margin: 0 rem-calc(-10); - ul { - list-style: none; - margin: 0 auto; - margin-bottom: 0; - padding-left: 0; + @include breakpoint(large) { + margin: 0; + } + + li { + border: 1px solid $border; + display: block; + margin: rem-calc(-1) 0; + position: relative; + + @include breakpoint(large down) { + + &::after { + content: '\63'; + font-family: "icons" !important; + font-size: rem-calc(24); + pointer-events: none; + position: absolute; + right: 12px; + top: 12px; + } } - li { - border-bottom: 2px solid transparent; - cursor: pointer; + @include breakpoint(large) { + background: #fafafa; display: inline-block; - margin-bottom: $line-height; - margin-right: $line-height; - transition: all 0.4s; + border-bottom: 0; + border-top-left-radius: rem-calc(6); + border-top-right-radius: rem-calc(6); + margin-bottom: 0; + margin-right: $line-height / 4; + margin-top: 0; - @include breakpoint(medium) { - margin-bottom: 0; + &:hover:not(.is-active) { + background: $highlight; } - &:hover, - &:active, - &:focus { - border-bottom: 2px solid $brand; - } - - a, - h4 { - display: block; - color: #6d6d6d; - margin-bottom: 0; + &::after { + content: ''; } } a { - &:hover, - &:active { + display: block; + padding: $line-height / 4 $line-height / 2; + + @include breakpoint(large) { + display: inline-block; + } + + &:hover { text-decoration: none; } - p { + h4 { margin-bottom: 0; + } + } + } - @include breakpoint(medium) { - margin-bottom: rem-calc(16); - } + span { + color: $text-medium; + font-size: $small-font-size; + } + + .is-active { + background: $highlight; + position: relative; + + @include breakpoint(large) { + background: none; + border: 1px solid $border; + border-bottom: 0; + + &::after { + border-bottom: 1px solid #fefefe; + bottom: -1px; + left: 0; + position: absolute; + width: 100%; } } - .is-active { - border-bottom: 2px solid $brand; - - a, - h4 { - color: $brand; - } + &::after { + content: ''; } } } diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index e9bfe02a4..be8cc74c3 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -80,6 +80,10 @@ class Legislation::Process < ActiveRecord::Base Legislation::Process::Publication.new(result_publication_date, result_publication_enabled) end + def enabled_phases? + PHASES_AND_PUBLICATIONS.any? { |process| send(process).enabled? } + end + def enabled_phases_and_publications_count PHASES_AND_PUBLICATIONS.count { |process| send(process).enabled? } end diff --git a/app/views/admin/legislation/homepages/_form.html.erb b/app/views/admin/legislation/homepages/_form.html.erb index e6b7cf2f4..aa3ee4151 100644 --- a/app/views/admin/legislation/homepages/_form.html.erb +++ b/app/views/admin/legislation/homepages/_form.html.erb @@ -11,7 +11,7 @@ <%= f.translatable_fields do |translations_form| %> -
+
<%= translations_form.cktext_area :homepage, language: I18n.locale, @@ -22,7 +22,7 @@
<% end %> -
+
<%= f.submit(class: "button success expanded", value: t("admin.legislation.processes.#{admin_submit_action(@process)}.submit_button")) %>
<% end %> diff --git a/app/views/legislation/processes/_key_dates.html.erb b/app/views/legislation/processes/_key_dates.html.erb index 6fbea5053..7181e68cf 100644 --- a/app/views/legislation/processes/_key_dates.html.erb +++ b/app/views/legislation/processes/_key_dates.html.erb @@ -1,65 +1,65 @@ - diff --git a/config/locales/en/legislation.yml b/config/locales/en/legislation.yml index ed142fd49..e1c71f6c6 100644 --- a/config/locales/en/legislation.yml +++ b/config/locales/en/legislation.yml @@ -82,7 +82,7 @@ en: see_latest_comments: See latest comments see_latest_comments_title: Comment on this process shared: - key_dates: Key dates + key_dates: Participation phases debate_dates: Debate draft_publication_date: Draft publication allegations_dates: Comments diff --git a/config/locales/es-AR/legislation.yml b/config/locales/es-AR/legislation.yml index 846e74d5a..92714dc19 100644 --- a/config/locales/es-AR/legislation.yml +++ b/config/locales/es-AR/legislation.yml @@ -73,7 +73,7 @@ es-AR: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-BO/legislation.yml b/config/locales/es-BO/legislation.yml index 1b5d5ed55..852470826 100644 --- a/config/locales/es-BO/legislation.yml +++ b/config/locales/es-BO/legislation.yml @@ -73,7 +73,7 @@ es-BO: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-CL/legislation.yml b/config/locales/es-CL/legislation.yml index ab17069ee..2a254f7f7 100644 --- a/config/locales/es-CL/legislation.yml +++ b/config/locales/es-CL/legislation.yml @@ -73,7 +73,7 @@ es-CL: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-CO/legislation.yml b/config/locales/es-CO/legislation.yml index aaae703d3..1b8a17637 100644 --- a/config/locales/es-CO/legislation.yml +++ b/config/locales/es-CO/legislation.yml @@ -73,7 +73,7 @@ es-CO: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-CR/legislation.yml b/config/locales/es-CR/legislation.yml index db9d5cda4..c262a9e53 100644 --- a/config/locales/es-CR/legislation.yml +++ b/config/locales/es-CR/legislation.yml @@ -73,7 +73,7 @@ es-CR: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-DO/legislation.yml b/config/locales/es-DO/legislation.yml index 5492300ec..9d737a8dd 100644 --- a/config/locales/es-DO/legislation.yml +++ b/config/locales/es-DO/legislation.yml @@ -73,7 +73,7 @@ es-DO: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-EC/legislation.yml b/config/locales/es-EC/legislation.yml index ec08d9ed0..cad9eb51d 100644 --- a/config/locales/es-EC/legislation.yml +++ b/config/locales/es-EC/legislation.yml @@ -73,7 +73,7 @@ es-EC: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-GT/legislation.yml b/config/locales/es-GT/legislation.yml index 03328bcfb..2a672648f 100644 --- a/config/locales/es-GT/legislation.yml +++ b/config/locales/es-GT/legislation.yml @@ -73,7 +73,7 @@ es-GT: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-HN/legislation.yml b/config/locales/es-HN/legislation.yml index 1184bda4b..8b10aa0e4 100644 --- a/config/locales/es-HN/legislation.yml +++ b/config/locales/es-HN/legislation.yml @@ -73,7 +73,7 @@ es-HN: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-MX/legislation.yml b/config/locales/es-MX/legislation.yml index cd64b6353..81697e493 100644 --- a/config/locales/es-MX/legislation.yml +++ b/config/locales/es-MX/legislation.yml @@ -73,7 +73,7 @@ es-MX: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-NI/legislation.yml b/config/locales/es-NI/legislation.yml index d364ccb00..c112c516c 100644 --- a/config/locales/es-NI/legislation.yml +++ b/config/locales/es-NI/legislation.yml @@ -73,7 +73,7 @@ es-NI: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-PA/legislation.yml b/config/locales/es-PA/legislation.yml index bfade7487..59fc865ce 100644 --- a/config/locales/es-PA/legislation.yml +++ b/config/locales/es-PA/legislation.yml @@ -73,7 +73,7 @@ es-PA: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-PE/legislation.yml b/config/locales/es-PE/legislation.yml index 8732d96eb..1a6088a98 100644 --- a/config/locales/es-PE/legislation.yml +++ b/config/locales/es-PE/legislation.yml @@ -73,7 +73,7 @@ es-PE: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-PR/legislation.yml b/config/locales/es-PR/legislation.yml index 7aa3e0aa0..a8a8daad1 100644 --- a/config/locales/es-PR/legislation.yml +++ b/config/locales/es-PR/legislation.yml @@ -73,7 +73,7 @@ es-PR: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-PY/legislation.yml b/config/locales/es-PY/legislation.yml index 60b9864fa..6d18bb589 100644 --- a/config/locales/es-PY/legislation.yml +++ b/config/locales/es-PY/legislation.yml @@ -73,7 +73,7 @@ es-PY: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-SV/legislation.yml b/config/locales/es-SV/legislation.yml index 528d2ce5e..dae905caa 100644 --- a/config/locales/es-SV/legislation.yml +++ b/config/locales/es-SV/legislation.yml @@ -73,7 +73,7 @@ es-SV: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-UY/legislation.yml b/config/locales/es-UY/legislation.yml index 548cf6f5e..1917fb92e 100644 --- a/config/locales/es-UY/legislation.yml +++ b/config/locales/es-UY/legislation.yml @@ -73,7 +73,7 @@ es-UY: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-VE/legislation.yml b/config/locales/es-VE/legislation.yml index 38d51b1f7..79528f093 100644 --- a/config/locales/es-VE/legislation.yml +++ b/config/locales/es-VE/legislation.yml @@ -73,7 +73,7 @@ es-VE: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es/legislation.yml b/config/locales/es/legislation.yml index 766089a43..18bd8d5ef 100644 --- a/config/locales/es/legislation.yml +++ b/config/locales/es/legislation.yml @@ -82,7 +82,7 @@ es: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador allegations_dates: Comentarios diff --git a/spec/factories/legislations.rb b/spec/factories/legislations.rb index 79a617d67..e911f574e 100644 --- a/spec/factories/legislations.rb +++ b/spec/factories/legislations.rb @@ -100,6 +100,25 @@ FactoryBot.define do end_date { 1.week.from_now } end + trait :empty do + start_date { Date.current - 5.days } + end_date { Date.current + 5.days } + debate_start_date nil + debate_end_date nil + draft_publication_date nil + allegations_start_date nil + allegations_end_date nil + proposals_phase_start_date nil + proposals_phase_end_date nil + result_publication_date nil + debate_phase_enabled false + allegations_phase_enabled false + proposals_phase_enabled false + draft_publication_enabled false + result_publication_enabled false + published true + end + end factory :legislation_draft_version, class: 'Legislation::DraftVersion' do diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb index 7d286c85d..1bd51989d 100644 --- a/spec/features/legislation/processes_spec.rb +++ b/spec/features/legislation/processes_spec.rb @@ -47,17 +47,32 @@ feature 'Legislation' do end end - scenario 'Key dates are displayed on current locale' do + scenario 'Participation phases are displayed only if there is a phase enabled' do + process = create(:legislation_process, :empty) + process_debate = create(:legislation_process) + + visit legislation_process_path(process) + + expect(page).not_to have_content("Participation phases") + + visit legislation_process_path(process_debate) + + expect(page).to have_content("Participation phases") + end + + scenario 'Participation phases are displayed on current locale' do process = create(:legislation_process, proposals_phase_start_date: Date.new(2018, 01, 01), proposals_phase_end_date: Date.new(2018, 12, 01)) visit legislation_process_path(process) + expect(page).to have_content("Participation phases") expect(page).to have_content("Proposals") expect(page).to have_content("01 Jan 2018 - 01 Dec 2018") visit legislation_process_path(process, locale: "es") + expect(page).to have_content("Fases de participación") expect(page).to have_content("Propuestas") expect(page).to have_content("01 ene 2018 - 01 dic 2018") end