diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb
index be8cc74c3..dc880552b 100644
--- a/app/models/legislation/process.rb
+++ b/app/models/legislation/process.rb
@@ -18,8 +18,8 @@ class Legislation::Process < ActiveRecord::Base
translates :homepage, touch: true
include Globalizable
- PHASES_AND_PUBLICATIONS = %i[draft_phase debate_phase allegations_phase proposals_phase
- draft_publication result_publication].freeze
+ PHASES_AND_PUBLICATIONS = %i[homepage_phase draft_phase debate_phase allegations_phase
+ proposals_phase draft_publication result_publication].freeze
has_many :draft_versions, -> { order(:id) }, class_name: 'Legislation::DraftVersion',
foreign_key: 'legislation_process_id',
@@ -54,6 +54,10 @@ class Legislation::Process < ActiveRecord::Base
draft_end_date IS NOT NULL and (draft_start_date > ? or
draft_end_date < ?))", Date.current, Date.current) }
+ def homepage_phase
+ Legislation::Process::Phase.new(start_date, end_date, homepage_enabled)
+ end
+
def draft_phase
Legislation::Process::Phase.new(draft_start_date, draft_end_date, draft_phase_enabled)
end
diff --git a/app/views/legislation/processes/_key_dates.html.erb b/app/views/legislation/processes/_key_dates.html.erb
index 7181e68cf..b10fdb32c 100644
--- a/app/views/legislation/processes/_key_dates.html.erb
+++ b/app/views/legislation/processes/_key_dates.html.erb
@@ -6,6 +6,15 @@
<% end %>
+ <% if process.homepage_enabled? && process.homepage.present? %>
+ - >
+ <%= link_to legislation_process_path(process) do %>
+
<%= t("legislation.processes.shared.homepage") %>
+
+ <% end %>
+
+ <% end %>
+
<% if process.debate_phase.enabled? %>
- >
<%= link_to debate_legislation_process_path(process) do %>
diff --git a/app/views/legislation/processes/show.html.erb b/app/views/legislation/processes/show.html.erb
index fa4c54e97..4d8481879 100644
--- a/app/views/legislation/processes/show.html.erb
+++ b/app/views/legislation/processes/show.html.erb
@@ -4,9 +4,9 @@
<%= render 'documents/additional_documents', documents: @process.documents %>
-<%= render 'key_dates', process: @process, phase: :debate_phase %>
+<%= render 'key_dates', process: @process, phase: :homepage %>
-
+
<%= AdminWYSIWYGSanitizer.new.sanitize(@process.homepage) %>
diff --git a/config/locales/en/legislation.yml b/config/locales/en/legislation.yml
index e1c71f6c6..58384a0e1 100644
--- a/config/locales/en/legislation.yml
+++ b/config/locales/en/legislation.yml
@@ -83,6 +83,7 @@ en:
see_latest_comments_title: Comment on this process
shared:
key_dates: Participation phases
+ homepage: Homepage
debate_dates: Debate
draft_publication_date: Draft publication
allegations_dates: Comments
diff --git a/config/locales/es/legislation.yml b/config/locales/es/legislation.yml
index 18bd8d5ef..3702fbcb7 100644
--- a/config/locales/es/legislation.yml
+++ b/config/locales/es/legislation.yml
@@ -83,6 +83,7 @@ es:
see_latest_comments_title: Aportar a este proceso
shared:
key_dates: Fases de participación
+ homepage: Inicio
debate_dates: Debate previo
draft_publication_date: Publicación borrador
allegations_dates: Comentarios
diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb
index 1bd51989d..3379e53fc 100644
--- a/spec/features/legislation/processes_spec.rb
+++ b/spec/features/legislation/processes_spec.rb
@@ -201,6 +201,10 @@ feature 'Legislation' do
visit legislation_process_path(process)
+ within(".key-dates") do
+ expect(page).to have_content("Homepage")
+ end
+
expect(page).to have_content("This is the process homepage")
expect(page).not_to have_content("Participate in the debate")
end
@@ -213,6 +217,10 @@ feature 'Legislation' do
visit legislation_process_path(process)
+ within(".key-dates") do
+ expect(page).not_to have_content("Homepage")
+ end
+
expect(page).to have_content("This phase is not open yet")
expect(page).not_to have_content("This is the process homepage")
end