From 846898f3eca699e82a5adfa306082633e501f6a1 Mon Sep 17 00:00:00 2001 From: iagirre Date: Fri, 19 Jan 2018 11:51:18 +0100 Subject: [PATCH 1/4] New phase "Information" added and UI modified to not show the links. Specs to test the functionality added. --- app/assets/stylesheets/participation.scss | 3 +- app/models/budget.rb | 5 ++ app/models/budget/phase.rb | 3 +- app/views/budgets/index.html.erb | 45 ++++++----- config/locales/en/budgets.yml | 1 + config/locales/es/budgets.yml | 1 + ...28_add_description_informing_to_budgets.rb | 5 ++ db/schema.rb | 3 +- spec/factories.rb | 5 ++ spec/features/budgets/budgets_spec.rb | 80 ++++++++++++------- 10 files changed, 101 insertions(+), 50 deletions(-) create mode 100644 db/migrate/20180119073228_add_description_informing_to_budgets.rb diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 2152e07a7..6db84ed6f 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1239,7 +1239,8 @@ text-decoration: none; } - a { + a, + div { display: block; padding: $line-height / 2; diff --git a/app/models/budget.rb b/app/models/budget.rb index 8457ba1ac..28f37f4bc 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -21,6 +21,7 @@ class Budget < ActiveRecord::Base after_create :generate_phases scope :drafting, -> { where(phase: "drafting") } + scope :informing, -> { where(phase: "informing") } scope :accepting, -> { where(phase: "accepting") } scope :reviewing, -> { where(phase: "reviewing") } scope :selecting, -> { where(phase: "selecting") } @@ -64,6 +65,10 @@ class Budget < ActiveRecord::Base phase == "drafting" end + def informing? + phase == "informing" + end + def accepting? phase == "accepting" end diff --git a/app/models/budget/phase.rb b/app/models/budget/phase.rb index e625272d0..704d0b85f 100644 --- a/app/models/budget/phase.rb +++ b/app/models/budget/phase.rb @@ -1,6 +1,6 @@ class Budget class Phase < ActiveRecord::Base - PHASE_KINDS = %w(drafting accepting reviewing selecting valuating publishing_prices balloting + PHASE_KINDS = %w(drafting informing accepting reviewing selecting valuating publishing_prices balloting reviewing_ballots finished).freeze PUBLISHED_PRICES_PHASES = %w(publishing_prices balloting reviewing_ballots finished).freeze SUMMARY_MAX_LENGTH = 1000 @@ -26,6 +26,7 @@ class Budget scope :enabled, -> { where(enabled: true) } scope :published, -> { enabled.where.not(kind: 'drafting') } scope :drafting, -> { find_by_kind('drafting') } + scope :informing, -> { find_by_kind('informing') } scope :accepting, -> { find_by_kind('accepting')} scope :reviewing, -> { find_by_kind('reviewing')} scope :selecting, -> { find_by_kind('selecting')} diff --git a/app/views/budgets/index.html.erb b/app/views/budgets/index.html.erb index 303c123ec..dccaad5aa 100644 --- a/app/views/budgets/index.html.erb +++ b/app/views/budgets/index.html.erb @@ -67,9 +67,16 @@