From 73637de0d01829026ade4b60182cbe4260dc4538 Mon Sep 17 00:00:00 2001 From: decabeza Date: Wed, 9 Jan 2019 12:29:00 +0100 Subject: [PATCH] Adds homepage phase and tab to legislation processes show --- app/models/legislation/process.rb | 8 ++++++-- app/views/legislation/processes/_key_dates.html.erb | 9 +++++++++ app/views/legislation/processes/show.html.erb | 4 ++-- config/locales/en/legislation.yml | 1 + config/locales/es/legislation.yml | 1 + spec/features/legislation/processes_spec.rb | 8 ++++++++ 6 files changed, 27 insertions(+), 4 deletions(-) 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 %>