From 9176de949a972cee2176b43f9c4b7f5f4a074e0c Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 15 Jan 2018 18:37:03 +0100 Subject: [PATCH 01/18] Refactor concept of current budget When there was only one budget this implementation worked fine Nowadays there can be multiple budgets, and therefore the definition of the current_budget has changed. It is no longer a budget that has not finished, but rather, the last budget created that is not in the initial drafting phase. Budgets in the drafting phase are not considered the current_budget, but rather a budget that is still being prepared and that soon will become the current_budget --- app/models/budget.rb | 8 +++----- spec/models/budget_spec.rb | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/app/models/budget.rb b/app/models/budget.rb index af1149d66..55c4de841 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -31,7 +31,9 @@ class Budget < ActiveRecord::Base scope :reviewing_ballots, -> { where(phase: "reviewing_ballots") } scope :finished, -> { where(phase: "finished") } - scope :current, -> { where.not(phase: "finished") } + def self.current + where.not(phase: "drafting").last + end def description send("description_#{phase}").try(:html_safe) @@ -93,10 +95,6 @@ class Budget < ActiveRecord::Base balloting_process? || finished? end - def current? - !finished? - end - def heading_price(heading) heading_ids.include?(heading.id) ? heading.price : -1 end diff --git a/spec/models/budget_spec.rb b/spec/models/budget_spec.rb index 70c292962..9bca092ea 100644 --- a/spec/models/budget_spec.rb +++ b/spec/models/budget_spec.rb @@ -98,6 +98,31 @@ describe Budget do end end + describe "#current" do + + it "returns nil if there is only one budget and it is still in drafting phase" do + budget = create(:budget, phase: "drafting") + + expect(Budget.current).to eq(nil) + end + + it "returns the budget if there is only one and not in drafting phase" do + budget = create(:budget, phase: "accepting") + + expect(Budget.current).to eq(budget) + end + + it "returns the last budget created that is not in drafting phase" do + old_budget = create(:budget, phase: "finished", created_at: 2.years.ago) + previous_budget = create(:budget, phase: "accepting", created_at: 1.year.ago) + current_budget = create(:budget, phase: "accepting", created_at: 1.month.ago) + next_budget = create(:budget, phase: "drafting", created_at: 1.week.ago) + + expect(Budget.current).to eq(current_budget) + end + + end + describe "heading_price" do let(:budget) { create(:budget) } let(:group) { create(:budget_group, budget: budget) } From be554a629c00ae2cb9943bf6cb148d317b2a70d7 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 15 Jan 2018 18:37:32 +0100 Subject: [PATCH 02/18] Make current_budget accessible in controller and views --- app/controllers/application_controller.rb | 5 +++++ .../application_controller_spec.rb | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 spec/controllers/application_controller_spec.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 495a25314..f03a05239 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -25,6 +25,7 @@ class ApplicationController < ActionController::Base layout :set_layout respond_to :html + helper_method :current_budget private @@ -120,4 +121,8 @@ class ApplicationController < ActionController::Base params[:filter] ||= "selected" end end + + def current_budget + Budget.current + end end diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb new file mode 100644 index 000000000..f11068b65 --- /dev/null +++ b/spec/controllers/application_controller_spec.rb @@ -0,0 +1,19 @@ +require 'rails_helper' + +describe ApplicationController do + + describe "#current_budget" do + + it "returns the last budget that is not in draft phase" do + old_budget = create(:budget, phase: "finished", created_at: 2.years.ago) + previous_budget = create(:budget, phase: "accepting", created_at: 1.year.ago) + current_budget = create(:budget, phase: "accepting", created_at: 1.month.ago) + next_budget = create(:budget, phase: "drafting", created_at: 1.week.ago) + + budget = subject.instance_eval{ current_budget } + expect(budget).to eq(current_budget) + end + + end + +end \ No newline at end of file From 39b55e11df7edc2befb8e03f41d4e0e72c6e1403 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 15 Jan 2018 21:21:24 +0100 Subject: [PATCH 03/18] changes text and makes bigger link to delete a marker on a map --- app/assets/stylesheets/layout.scss | 19 +++++++++++++++++++ app/helpers/map_locations_helper.rb | 2 +- config/locales/es/budgets.yml | 2 +- config/locales/es/general.yml | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index e47ba0343..b5a3b794d 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -22,6 +22,7 @@ // 20. Documents // 21. Related content // 22. Images +// 23. Maps // // 01. Global styles @@ -2511,3 +2512,21 @@ table { .images .button { margin-top: $line-height / 2; } + +// 23. Maps +// ----------------- + +.location-map-remove-marker { + border-bottom: 1px dotted #cf2a0e; + color: $delete; + display: inline-block; + margin-top: $line-height / 2; + + &:hover, + &:active, + &:focus { + border-bottom: 1px solid #cf2a0e; + color: #cf2a0e; + text-decoration: none; + } +} diff --git a/app/helpers/map_locations_helper.rb b/app/helpers/map_locations_helper.rb index ae45e7c1d..e20d5e21a 100644 --- a/app/helpers/map_locations_helper.rb +++ b/app/helpers/map_locations_helper.rb @@ -34,7 +34,7 @@ module MapLocationsHelper end def map_location_remove_marker(map_location, text) - content_tag :div, class: "text-right" do + content_tag :div, class: "margin-bottom" do content_tag :a, id: map_location_remove_marker_link_id(map_location), href: "#", diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml index 258f394d6..5bc0c0e63 100644 --- a/config/locales/es/budgets.yml +++ b/config/locales/es/budgets.yml @@ -59,7 +59,7 @@ es: tags_placeholder: "Escribe las etiquetas que desees separadas por una coma (',')" map_location: "Ubicación en el mapa" map_location_instructions: "Navega por el mapa hasta la ubicación y coloca el marcador." - map_remove_marker: "Eliminar el marcador" + map_remove_marker: "Eliminar marcador en el mapa" location: "Información adicional de la ubicación" index: title: Presupuestos participativos diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index cf497ae9d..41d148541 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -338,7 +338,7 @@ es: tags_placeholder: "Escribe las etiquetas que desees separadas por una coma (',')" map_location: "Ubicación en el mapa" map_location_instructions: "Navega por el mapa hasta la ubicación y coloca el marcador." - map_remove_marker: "Eliminar el marcador" + map_remove_marker: "Eliminar marcador en el mapa" map_skip_checkbox: "Esta propuesta no tiene una ubicación concreta o no la conozco." index: featured_proposals: Destacadas From 97bf00817ca798a92bc65fb6f8a2dc17a64d75db Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 15 Jan 2018 21:21:44 +0100 Subject: [PATCH 04/18] fixes js class name --- app/assets/javascripts/map.js.coffee | 2 +- app/helpers/map_locations_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/map.js.coffee b/app/assets/javascripts/map.js.coffee index 797232c4f..28ac34f29 100644 --- a/app/assets/javascripts/map.js.coffee +++ b/app/assets/javascripts/map.js.coffee @@ -83,4 +83,4 @@ App.Map = toogleMap: -> $('.map').toggle() - $('.location-map-remove-marker-button').toggle() \ No newline at end of file + $('.js-location-map-remove-marker').toggle() \ No newline at end of file diff --git a/app/helpers/map_locations_helper.rb b/app/helpers/map_locations_helper.rb index e20d5e21a..85b02e28c 100644 --- a/app/helpers/map_locations_helper.rb +++ b/app/helpers/map_locations_helper.rb @@ -38,7 +38,7 @@ module MapLocationsHelper content_tag :a, id: map_location_remove_marker_link_id(map_location), href: "#", - class: "location-map-remove-marker-button delete" do + class: "js-location-map-remove-marker location-map-remove-marker" do text end end From 2763f65c7daab1887d0d832b683ba5ebb0794d65 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 15 Jan 2018 21:24:06 +0100 Subject: [PATCH 05/18] updates texts on new budget investment form --- config/locales/en/activerecord.yml | 2 +- config/locales/es/activerecord.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml index 39d0e022a..c0b16dedb 100644 --- a/config/locales/en/activerecord.yml +++ b/config/locales/en/activerecord.yml @@ -118,7 +118,7 @@ en: heading_id: "Heading" title: "Title" location: "Location" - organization_name: "If you are proposing in the name of a collective/organization, write its name" + organization_name: "If you are proposing in the name of a collective/organization, or on behalf of more people, write its name" image: "Proposal descriptive image" image_title: "Image title" budget/investment/milestone: diff --git a/config/locales/es/activerecord.yml b/config/locales/es/activerecord.yml index 18296b7bf..522ecefa9 100644 --- a/config/locales/es/activerecord.yml +++ b/config/locales/es/activerecord.yml @@ -113,7 +113,7 @@ es: external_url: "Enlace a documentación adicional" location: "Ubicación" administrator_id: "Administrador" - organization_name: "Si estás proponiendo en nombre de una organización o colectivo, escribe su nombre" + organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre" image: "Imagen descriptiva de la propuesta de inversión" image_title: "Título de la imagen" budget/heading: From 9f93f11e907d1cdde4d3687966bb160449605a01 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 15 Jan 2018 21:30:42 +0100 Subject: [PATCH 06/18] changes organization name on budget investment show --- config/locales/en/budgets.yml | 2 +- config/locales/es/budgets.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml index a0fd28cac..fce3a3ff9 100644 --- a/config/locales/en/budgets.yml +++ b/config/locales/en/budgets.yml @@ -104,7 +104,7 @@ en: unfeasibility_explanation: Unfeasibility explanation code_html: 'Investment project code: %{code}' location_html: 'Location: %{location}' - organization_name_html: 'Organization: %{name}' + organization_name_html: 'Proposed on behalf of: %{name}' share: Share title: Investment project supports: Supports diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml index 5bc0c0e63..c00b5b714 100644 --- a/config/locales/es/budgets.yml +++ b/config/locales/es/budgets.yml @@ -104,7 +104,7 @@ es: unfeasibility_explanation: Informe de inviabilidad code_html: 'Código propuesta de gasto: %{code}' location_html: 'Ubicación: %{location}' - organization_name_html: 'Organización: %{name}' + organization_name_html: 'Propuesto en nombre de: %{name}' share: Compartir title: Proyecto de inversión supports: Apoyos From 8d0563e949a8b4630c47703d308800f5fb73e213 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 15 Jan 2018 21:33:48 +0100 Subject: [PATCH 07/18] fixes wrap text on investment projects with long titles --- app/assets/stylesheets/participation.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index bc8633ec9..606de72f3 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -339,6 +339,7 @@ .topic-show, .milestone-content { + h1, p { word-wrap: break-word; } From efa15b2a7174d1bac2733ebe29972192a0c914b0 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 15 Jan 2018 21:38:58 +0100 Subject: [PATCH 08/18] fixes a11y color contrast on map zoom control --- app/assets/stylesheets/layout.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index b5a3b794d..6ab56b14d 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -2530,3 +2530,10 @@ table { text-decoration: none; } } + +.leaflet-bar a { + + &.leaflet-disabled { + color: #525252 !important; + } +} From 8d469c10043b8fe8d004f0de5dab212af3eb11f9 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 15 Jan 2018 21:40:56 +0100 Subject: [PATCH 09/18] fixes lint scss warnings --- app/assets/stylesheets/layout.scss | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 6ab56b14d..854d6b1e6 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -2428,10 +2428,6 @@ table { margin-bottom: 0 !important; padding: $line-height / 2; - &:first-child { - border-top: 1px solid $border; - } - @include breakpoint(medium) { .score-actions { @@ -2440,6 +2436,10 @@ table { } } + &:first-child { + border-top: 1px solid $border; + } + &:hover { background: #f9f9f9; @@ -2479,8 +2479,8 @@ table { position: relative; text-decoration: none; - &.score-positive:before, - &.score-negative:before { + &.score-positive::before, + &.score-negative::before { font-family: 'icons'; left: 0; position: absolute; @@ -2489,7 +2489,7 @@ table { &.score-positive { color: $color-success; - &:before { + &::before { color: $color-success; content: '\6c'; } @@ -2498,7 +2498,7 @@ table { &.score-negative { color: $color-alert; - &:before { + &::before { color: $color-alert; content: '\76'; } From 349780922d2dc1d132ac24fe2762645dddb82f54 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 15 Jan 2018 20:23:46 +0100 Subject: [PATCH 10/18] Add Budget.open scope Before Budget.current could return multiple budgets, now there can only be a single current_budget. Adding the concept of open, which better reflects what the admin sees in this page: A tab for open budgets and a tab for finished budgets --- app/controllers/admin/budgets_controller.rb | 2 +- app/models/budget.rb | 1 + spec/models/budget_spec.rb | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/budgets_controller.rb b/app/controllers/admin/budgets_controller.rb index d2f8706c0..7dbd66d7b 100644 --- a/app/controllers/admin/budgets_controller.rb +++ b/app/controllers/admin/budgets_controller.rb @@ -2,7 +2,7 @@ class Admin::BudgetsController < Admin::BaseController include FeatureFlags feature_flag :budgets - has_filters %w{current finished}, only: :index + has_filters %w{open finished}, only: :index load_and_authorize_resource diff --git a/app/models/budget.rb b/app/models/budget.rb index 55c4de841..608599217 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -30,6 +30,7 @@ class Budget < ActiveRecord::Base scope :balloting, -> { where(phase: "balloting") } scope :reviewing_ballots, -> { where(phase: "reviewing_ballots") } scope :finished, -> { where(phase: "finished") } + scope :open, -> { where.not(phase: "finished") } def self.current where.not(phase: "drafting").last diff --git a/spec/models/budget_spec.rb b/spec/models/budget_spec.rb index 9bca092ea..f8ec2d5a5 100644 --- a/spec/models/budget_spec.rb +++ b/spec/models/budget_spec.rb @@ -123,6 +123,18 @@ describe Budget do end + describe "#open" do + + it "returns all budgets that are not in the finished phase" do + phases = Budget::PHASES - ["finished"] + phases.each do |phase| + budget = create(:budget, phase: phase) + expect(Budget.open).to include(budget) + end + end + + end + describe "heading_price" do let(:budget) { create(:budget) } let(:group) { create(:budget_group, budget: budget) } From 01ef4390535f65792c5cc636e8e69f4f214cb105 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 15 Jan 2018 20:26:57 +0100 Subject: [PATCH 11/18] Display only current budget to Managers printing investments In the specs, some investment were missing a heading_id, thus creating another unexpected budget By explicitly setting the heading_id we can control better which budgets are created in each test --- app/controllers/management/budgets_controller.rb | 2 +- .../management/budgets/print_investments.html.erb | 10 ++++------ spec/features/management/budget_investments_spec.rb | 7 +++++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/controllers/management/budgets_controller.rb b/app/controllers/management/budgets_controller.rb index dd7259c99..470d1f9fd 100644 --- a/app/controllers/management/budgets_controller.rb +++ b/app/controllers/management/budgets_controller.rb @@ -19,7 +19,7 @@ class Management::BudgetsController < Management::BaseController end def print_investments - @budgets = Budget.current.order(created_at: :desc).page(params[:page]) + @budget = Budget.current end private diff --git a/app/views/management/budgets/print_investments.html.erb b/app/views/management/budgets/print_investments.html.erb index bc115ea3d..d5be7c1ff 100644 --- a/app/views/management/budgets/print_investments.html.erb +++ b/app/views/management/budgets/print_investments.html.erb @@ -1,12 +1,10 @@ -<% @budgets.each do |budget| %> - - - + + + -<% end %>
<%= budget.name %><%= budget.translated_phase %>
<%= @budget.name %><%= @budget.translated_phase %> <%= link_to t("management.budgets.print_investments"), - print_management_budget_investments_path(budget) %> + print_management_budget_investments_path(@budget) %>
diff --git a/spec/features/management/budget_investments_spec.rb b/spec/features/management/budget_investments_spec.rb index f1ced7334..6132c40cd 100644 --- a/spec/features/management/budget_investments_spec.rb +++ b/spec/features/management/budget_investments_spec.rb @@ -259,9 +259,10 @@ feature 'Budget Investments' do context "Printing" do scenario 'Printing budget investments' do - 16.times { create(:budget_investment, budget: @budget) } + 16.times { create(:budget_investment, budget: @budget, heading: @heading) } click_link "Print Budget Investments" + expect(page).to have_content(@budget.name) within "#budget_#{@budget.id}" do click_link "Print Budget Investments" @@ -273,15 +274,17 @@ feature 'Budget Investments' do scenario "Filtering budget investments by heading to be printed", :js do district_9 = create(:budget_heading, group: @group, name: "District Nine") + another_heading = create(:budget_heading, group: @group) low_investment = create(:budget_investment, budget: @budget, title: 'Nuke district 9', heading: district_9, cached_votes_up: 1) mid_investment = create(:budget_investment, budget: @budget, title: 'Change district 9', heading: district_9, cached_votes_up: 10) top_investment = create(:budget_investment, budget: @budget, title: 'Destroy district 9', heading: district_9, cached_votes_up: 100) - unvoted_investment = create(:budget_investment, budget: @budget, title: 'Add new districts to the city') + unvoted_investment = create(:budget_investment, budget: @budget, heading: another_heading, title: 'Add new districts to the city') user = create(:user, :level_two) login_managed_user(user) click_link "Print Budget Investments" + expect(page).to have_content(@budget.name) within "#budget_#{@budget.id}" do click_link "Print Budget Investments" From 5086314bee20ec0a61065c498c7fe8b3855a2d52 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 15 Jan 2018 20:29:49 +0100 Subject: [PATCH 12/18] Display only current budget for Valuators Before we could have multiple current budgets, as we now only have one current_budget, some specs broke. As there is no need to display multiple budgets to Valuators, only the current budget is necessary, we can remove arrays and assume that only a single budget, the current budget, is displayed to Valuators --- .../valuation/budgets_controller.rb | 8 ++-- app/views/valuation/budgets/index.html.erb | 38 ++++++++----------- spec/features/valuation/budgets_spec.rb | 15 +++----- 3 files changed, 26 insertions(+), 35 deletions(-) diff --git a/app/controllers/valuation/budgets_controller.rb b/app/controllers/valuation/budgets_controller.rb index 744b0d4bf..cf99f95e3 100644 --- a/app/controllers/valuation/budgets_controller.rb +++ b/app/controllers/valuation/budgets_controller.rb @@ -5,10 +5,10 @@ class Valuation::BudgetsController < Valuation::BaseController load_and_authorize_resource def index - @budgets = @budgets.current.order(created_at: :desc).page(params[:page]) - @investments_with_valuation_open = {} - @budgets.each do |b| - @investments_with_valuation_open[b.id] = b.investments + @budget = Budget.current + if @budget.present? + @investments_with_valuation_open = {} + @investments_with_valuation_open = @budget.investments .by_valuator(current_user.valuator.try(:id)) .valuation_open .count diff --git a/app/views/valuation/budgets/index.html.erb b/app/views/valuation/budgets/index.html.erb index 6d65f9ee6..f1fd302b6 100644 --- a/app/views/valuation/budgets/index.html.erb +++ b/app/views/valuation/budgets/index.html.erb @@ -1,7 +1,5 @@

<%= t("valuation.budgets.index.title") %>

-

<%= page_entries_info @budgets %>

- @@ -12,25 +10,21 @@ - <% @budgets.each do |budget| %> - - - - - - - <% end %> + + + + + +
- <%= budget.name %> - - <%= t("budgets.phase.#{budget.phase}") %> - - <%= @investments_with_valuation_open[budget.id] %> - - <%= link_to t("valuation.budgets.index.evaluate"), - valuation_budget_budget_investments_path(budget_id: budget.id), - class: "button hollow expanded" %> -
+ <%= @budget.name %> + + <%= t("budgets.phase.#{@budget.phase}") %> + + <%= @investments_with_valuation_open %> + + <%= link_to t("valuation.budgets.index.evaluate"), + valuation_budget_budget_investments_path(budget_id: @budget.id), + class: "button hollow expanded" %> +
- -<%= paginate @budgets %> diff --git a/spec/features/valuation/budgets_spec.rb b/spec/features/valuation/budgets_spec.rb index ec3b780ab..4fd821c7e 100644 --- a/spec/features/valuation/budgets_spec.rb +++ b/spec/features/valuation/budgets_spec.rb @@ -24,18 +24,15 @@ feature 'Valuation budgets' do end scenario 'Filters by phase' do - budget1 = create(:budget) - budget2 = create(:budget, :accepting) - budget3 = create(:budget, :selecting) - budget4 = create(:budget, :balloting) - budget5 = create(:budget, :finished) + budget1 = create(:budget, :finished) + budget2 = create(:budget, :finished) + budget3 = create(:budget, :accepting) visit valuation_budgets_path - expect(page).to have_content(budget1.name) - expect(page).to have_content(budget2.name) + + expect(page).to_not have_content(budget1.name) + expect(page).to_not have_content(budget2.name) expect(page).to have_content(budget3.name) - expect(page).to have_content(budget4.name) - expect(page).not_to have_content(budget5.name) end end From 34e0c23bb37bbd0c7b9b17d26a71d6adec9802e2 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 15 Jan 2018 20:34:30 +0100 Subject: [PATCH 13/18] Fix valuators authorization spec This spec used to pass, because even though there were no budgets, as Budget.current returned an array, it gracefully handled situations without budgets Now we assume that there can only be a single current budget, and so calling any method of budget will raise an exception unless there is a current budget present Valuators should not access this page when there is no budget present, however it might be wise to create an issue to cover this case, just in case --- spec/features/valuation_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/features/valuation_spec.rb b/spec/features/valuation_spec.rb index c004f0773..1cb95d23d 100644 --- a/spec/features/valuation_spec.rb +++ b/spec/features/valuation_spec.rb @@ -66,6 +66,8 @@ feature 'Valuation' do scenario 'Access as a valuator is authorized' do create(:valuator, user: user) + create(:budget) + login_as(user) visit root_path @@ -78,6 +80,8 @@ feature 'Valuation' do scenario 'Access as an administrator is authorized' do create(:administrator, user: user) + create(:budget) + login_as(user) visit root_path @@ -90,6 +94,8 @@ feature 'Valuation' do scenario "Valuation access links" do create(:valuator, user: user) + create(:budget) + login_as(user) visit root_path @@ -100,6 +106,8 @@ feature 'Valuation' do scenario 'Valuation dashboard' do create(:valuator, user: user) + create(:budget) + login_as(user) visit root_path From 0114286e6c4f9ae17b4f1ad819a71bd56f3224b3 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 16 Jan 2018 11:30:58 +0100 Subject: [PATCH 14/18] adds class to improve table on mobile version --- app/views/admin/budget_investments/_investments.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index 55ccf7f30..a60e2ac11 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -4,7 +4,7 @@ <% if @investments.any? %>

<%= page_entries_info @investments %>

- +
From 32e746ddb3a5faf6138c9cbc64be5371a5602bbe Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 16 Jan 2018 12:46:15 +0100 Subject: [PATCH 15/18] Add maps config variables to secrets example file --- config/secrets.yml.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/secrets.yml.example b/config/secrets.yml.example index 3939d7b80..5157e350c 100644 --- a/config/secrets.yml.example +++ b/config/secrets.yml.example @@ -17,11 +17,11 @@ apis: &apis http_basic_auth: &http_basic_auth http_basic_auth: true - development: http_basic_username: "dev" http_basic_password: "pass" <<: *default + <<: *maps test: <<: *default From 7d222db84be4799af486e528c9e298c866a5e76e Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 16 Jan 2018 14:21:36 +0100 Subject: [PATCH 16/18] Fix budget investment location label title --- config/locales/en/activerecord.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml index c0b16dedb..931d7c62b 100644 --- a/config/locales/en/activerecord.yml +++ b/config/locales/en/activerecord.yml @@ -117,7 +117,7 @@ en: external_url: "Link to additional documentation" heading_id: "Heading" title: "Title" - location: "Location" + location: "Location (optional)" organization_name: "If you are proposing in the name of a collective/organization, or on behalf of more people, write its name" image: "Proposal descriptive image" image_title: "Image title" From 029178651fe28ee9103927a6606ecc133d41da6a Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 16 Jan 2018 14:22:22 +0100 Subject: [PATCH 17/18] Update unreleased section of changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bf08d329..24ffaa9b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Improve budget investment form https://github.com/consul/consul/pull/2280 - Prevent edition of investments if budget is in the final phase https://github.com/consul/consul/pull/2223 - Split 'routes.rb' file into multiple small files https://github.com/consul/consul/pull/1908 +- Design Improvements https://github.com/consul/consul/pull/2327 ### Deprecated From 86cc494cd709236fc613f12999b72f21969596c6 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 16 Jan 2018 14:48:38 +0100 Subject: [PATCH 18/18] Update letter opener, grpahql and sitemap gnerator gems --- Gemfile | 6 +++--- Gemfile.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index ed9d6fe56..a0dacb7bf 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'devise_security_extension', '~> 0.10.0' gem 'foundation-rails', '~> 6.2.4.0' gem 'foundation_rails_helper', '~> 2.0.0' gem 'graphiql-rails', '~> 1.4.1' -gem 'graphql', '~> 1.7.7' +gem 'graphql', '~> 1.7.8' gem 'groupdate', '~> 3.2.0' gem 'initialjs-rails', '~> 0.2.0.5' gem 'invisible_captcha', '~> 0.10.0' @@ -44,7 +44,7 @@ gem 'rollbar', '~> 2.15.5' gem 'rubyzip', '~> 1.2.0' gem 'sass-rails', '~> 5.0', '>= 5.0.4' gem 'savon', '~> 2.11.1' -gem 'sitemap_generator', '~> 6.0.0' +gem 'sitemap_generator', '~> 6.0.1' gem 'social-share-button', '~> 1.1' gem 'sprockets', '~> 3.7.1' gem 'turbolinks', '~> 2.5.3' @@ -66,7 +66,7 @@ group :development, :test do gem 'i18n-tasks', '~> 0.9.15' gem 'knapsack_pro', '~> 0.53.0' gem 'launchy', '~> 2.4.3' - gem 'letter_opener_web', '~> 1.3.1' + gem 'letter_opener_web', '~> 1.3.2' gem 'quiet_assets', '~> 1.1.0' gem 'spring', '~> 2.0.1' gem 'spring-commands-rspec', '~> 1.0.4' diff --git a/Gemfile.lock b/Gemfile.lock index 16770f1bc..0be37f902 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -522,7 +522,7 @@ DEPENDENCIES foundation-rails (~> 6.2.4.0) foundation_rails_helper (~> 2.0.0) graphiql-rails (~> 1.4.1) - graphql (~> 1.7.7) + graphql (~> 1.7.8) groupdate (~> 3.2.0) i18n-tasks (~> 0.9.15) initialjs-rails (~> 0.2.0.5) @@ -533,7 +533,7 @@ DEPENDENCIES kaminari (~> 1.1.1) knapsack_pro (~> 0.53.0) launchy (~> 2.4.3) - letter_opener_web (~> 1.3.1) + letter_opener_web (~> 1.3.2) mdl (~> 0.4.0) newrelic_rpm (~> 4.1.0.333) omniauth (~> 1.8.1) @@ -561,7 +561,7 @@ DEPENDENCIES sass-rails (~> 5.0, >= 5.0.4) savon (~> 2.11.1) scss_lint (~> 0.54.0) - sitemap_generator (~> 6.0.0) + sitemap_generator (~> 6.0.1) social-share-button (~> 1.1) spring (~> 2.0.1) spring-commands-rspec (~> 1.0.4)
<%= t("admin.budget_investments.index.table_id") %>