From 5f7269a070050e67ddbe8c3c88dad9618d251d70 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 16 Jan 2017 03:09:08 +0100 Subject: [PATCH 1/9] displays unfeasible budgets link from home --- app/controllers/budgets_controller.rb | 1 - app/views/budgets/groups/show.html.erb | 16 ++++++- .../budgets/investments/_header.html.erb | 2 +- .../budgets/investments/_sidebar.html.erb | 1 - app/views/budgets/show.html.erb | 18 +++++++- spec/features/budgets/investments_spec.rb | 43 ++++++++++++------- 6 files changed, 60 insertions(+), 21 deletions(-) diff --git a/app/controllers/budgets_controller.rb b/app/controllers/budgets_controller.rb index 9c8a2036b..ee26f3223 100644 --- a/app/controllers/budgets_controller.rb +++ b/app/controllers/budgets_controller.rb @@ -2,7 +2,6 @@ class BudgetsController < ApplicationController include FeatureFlags feature_flag :budgets - load_and_authorize_resource respond_to :html, :js diff --git a/app/views/budgets/groups/show.html.erb b/app/views/budgets/groups/show.html.erb index 8bfbc21a1..0f368cd4f 100644 --- a/app/views/budgets/groups/show.html.erb +++ b/app/views/budgets/groups/show.html.erb @@ -7,6 +7,12 @@ +
+ <% if params[:unfeasible] %> + Propuestas inviables + <% end %> +
+
@@ -16,7 +22,8 @@ <%= link_to heading.name, - budget_investments_path(heading_id: heading.id), + budget_investments_path(heading_id: heading.id, + unfeasible: params[:unfeasible]), data: { no_turbolink: true } %>
<% end %> @@ -29,3 +36,10 @@ <%= image_tag "map.jpg" %>
+ +<% if params[:unfeasible].blank? %> +
+ <%= link_to t("budgets.investments.index.sidebar.unfeasible"), + budget_path(@budget, unfeasible: 1) %> +
+<% end %> \ No newline at end of file diff --git a/app/views/budgets/investments/_header.html.erb b/app/views/budgets/investments/_header.html.erb index b58eea03c..f7f1ee81a 100644 --- a/app/views/budgets/investments/_header.html.erb +++ b/app/views/budgets/investments/_header.html.erb @@ -4,7 +4,7 @@
- <%= back_link_to budget_group_path(@budget, @heading.group) %> + <%= back_link_to budget_group_path(@budget, @heading.group, unfeasible: params[:unfeasible]) %> <% if can? :show, @ballot %> <%= link_to t("budgets.investments.header.check_ballot"), diff --git a/app/views/budgets/investments/_sidebar.html.erb b/app/views/budgets/investments/_sidebar.html.erb index 4075bb29e..c5c1b78f3 100644 --- a/app/views/budgets/investments/_sidebar.html.erb +++ b/app/views/budgets/investments/_sidebar.html.erb @@ -15,7 +15,6 @@ <%= render "shared/tag_cloud", taggable: 'budget/investment' %> <%= render 'budgets/investments/categories' %> -<%= render 'budgets/investments/feasibility_link' %> <% if @heading && can?(:show, @ballot) %> diff --git a/app/views/budgets/show.html.erb b/app/views/budgets/show.html.erb index d68f2023c..28cc29d44 100644 --- a/app/views/budgets/show.html.erb +++ b/app/views/budgets/show.html.erb @@ -41,6 +41,9 @@ + <% if params[:unfeasible] %> + Propuestas inviables + <% end %> <% @budget.groups.each do |group| %> @@ -48,10 +51,14 @@ @@ -61,3 +68,10 @@
<%= t('budgets.show.group') %>
<% if group.headings.count == 1 %> <%= link_to group.name, - budget_investments_path(@budget, heading_id: group.headings.first.id), + budget_investments_path(@budget, + heading_id: group.headings.first.id, + unfeasible: params[:unfeasible]), data: { no_turbolink: true } %> <% else %> - <%= link_to group.name, budget_group_path(@budget, group) %> + <%= link_to group.name, + budget_group_path(@budget, group, + unfeasible: params[:unfeasible]) %> <% end %>
+ +<% unless params[:unfeasible] %> +
+ <%= link_to t("budgets.investments.index.sidebar.unfeasible"), + budget_path(@budget, unfeasible: 1) %> +
+<% end %> \ No newline at end of file diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 21238c554..f52a15bdd 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -23,21 +23,6 @@ feature 'Budget Investments' do end end - scenario 'Feasibility links' do - visit budget_investments_path(budget, heading_id: heading.id) - expect(page).to_not have_content('Feasible projects') - - within('#sidebar') do - click_link 'Unfeasible projects' - end - expect(page).to have_current_path(budget_investments_path(budget, heading_id: heading.id, unfeasible: 1)) - - within('#sidebar') do - click_link 'Feasible projects' - end - expect(page).to have_current_path(budget_investments_path(budget, heading_id: heading.id, unfeasible: nil)) - end - context("Search") do scenario 'Search by text' do @@ -82,6 +67,34 @@ feature 'Budget Investments' do expect(page).to_not have_content(investment4.title) end end + + scenario "by unfeasibilty link for group with one heading", :focus do + group = create(:budget_group, name: 'All City', budget: budget) + heading = create(:budget_heading, name: "Madrid", group: group) + + visit budget_path(budget) + click_link 'Unfeasible projects' + + click_link "All City" + + expected_path = budget_investments_path(budget, heading_id: heading.id, unfeasible: 1) + expect(page).to have_current_path(expected_path) + end + + scenario "by unfeasibilty link for group with many headings", :focus do + group = create(:budget_group, name: 'Districts', budget: budget) + heading1 = create(:budget_heading, name: 'Carabanchel', group: group) + heading2 = create(:budget_heading, name: 'Barajas', group: group) + + visit budget_path(budget) + click_link 'Unfeasible projects' + + click_link 'Districts' + click_link 'Carabanchel' + + expected_path = budget_investments_path(budget, heading_id: heading1.id, unfeasible: 1) + expect(page).to have_current_path(expected_path) + end end context("Orders") do From 45450d74ffb2bf2f669072e9635aa0d8e81cbde5 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 16 Jan 2017 18:45:42 +0100 Subject: [PATCH 2/9] improves styles for unfeasible investments --- app/assets/stylesheets/participation.scss | 5 +++++ app/views/budgets/groups/show.html.erb | 20 ++++++++++++-------- app/views/budgets/investments/index.html.erb | 9 +++++---- app/views/budgets/show.html.erb | 19 ++++++++++--------- config/locales/budgets.en.yml | 4 ++++ config/locales/budgets.es.yml | 4 ++++ 6 files changed, 40 insertions(+), 21 deletions(-) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 7eb3433f5..ee9217777 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -894,6 +894,11 @@ .info { background: #6A2A72; + p { + margin-bottom: 0; + text-transform: uppercase; + } + @include breakpoint(medium) { border-top: rem-calc(6) solid #54225C; } diff --git a/app/views/budgets/groups/show.html.erb b/app/views/budgets/groups/show.html.erb index 0f368cd4f..73fb3288f 100644 --- a/app/views/budgets/groups/show.html.erb +++ b/app/views/budgets/groups/show.html.erb @@ -7,11 +7,13 @@
-
- <% if params[:unfeasible] %> - Propuestas inviables - <% end %> -
+<% if params[:unfeasible] %> +
+
+

<%= t("budgets.groups.show.unfeasible_title") %>

+
+
+<% end %>
@@ -39,7 +41,9 @@ <% if params[:unfeasible].blank? %>
- <%= link_to t("budgets.investments.index.sidebar.unfeasible"), - budget_path(@budget, unfeasible: 1) %> +
+ <%= link_to t("budgets.groups.show.unfeasible"), + budget_path(@budget, unfeasible: 1) %> +
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/budgets/investments/index.html.erb b/app/views/budgets/investments/index.html.erb index b3bcf03fe..50a2866f9 100644 --- a/app/views/budgets/investments/index.html.erb +++ b/app/views/budgets/investments/index.html.erb @@ -17,14 +17,15 @@
<% if params[:unfeasible].present? %> -

<%= t("budgets.investments.index.unfeasible") %>

-

+

<%= t("budgets.investments.index.unfeasible") %>: <%= @heading.name %>

+
<%= t("budgets.investments.index.unfeasible_text", definitions: link_to(t("budgets.investments.index.unfeasible_text_definitions"), "https://decide.madrid.es/participatory_budget_info#20")).html_safe %> -

+
+ <% else %> + <%= content_tag(:h2, t("budgets.investments.index.by_heading", heading: @heading.name)) if @heading.present? %> <% end %> - <%= content_tag(:h2, t("budgets.investments.index.by_heading", heading: @heading.name)) if @heading.present? %> <% if params[:search].present? %>

<%= page_entries_info @investments %> diff --git a/app/views/budgets/show.html.erb b/app/views/budgets/show.html.erb index 28cc29d44..958dd2b30 100644 --- a/app/views/budgets/show.html.erb +++ b/app/views/budgets/show.html.erb @@ -1,5 +1,5 @@
-
+
<%= back_link_to budgets_path %> @@ -10,9 +10,8 @@

<%= t('budgets.show.phase') %> -
- <%= t("budgets.phase.#{@budget.phase}") %>

+

<%= t("budgets.phase.#{@budget.phase}") %>

<% if @budget.accepting? %> <% if current_user %> @@ -38,12 +37,12 @@
+ <% if params[:unfeasible] %> +

<%= t("budgets.show.unfeasible_title") %>

+ <% end %> - <% if params[:unfeasible] %> - Propuestas inviables - <% end %> <% @budget.groups.each do |group| %> @@ -71,7 +70,9 @@ <% unless params[:unfeasible] %>
- <%= link_to t("budgets.investments.index.sidebar.unfeasible"), - budget_path(@budget, unfeasible: 1) %> +
+ <%= link_to t("budgets.show.unfeasible"), + budget_path(@budget, unfeasible: 1) %> +
-<% end %> \ No newline at end of file +<% end %> diff --git a/config/locales/budgets.en.yml b/config/locales/budgets.en.yml index 9b57f6b22..5e4861a16 100644 --- a/config/locales/budgets.en.yml +++ b/config/locales/budgets.en.yml @@ -22,6 +22,8 @@ en: groups: show: title: Select an option + unfeasible_title: Unfeasible investments + unfeasible: See unfeasible investments phase: accepting: Accepting proposals reviewing: Reviewing proposals @@ -103,3 +105,5 @@ en: show: group: Group phase: Actual phase + unfeasible_title: Unfeasible investments + unfeasible: See unfeasible investments \ No newline at end of file diff --git a/config/locales/budgets.es.yml b/config/locales/budgets.es.yml index 93c7a15aa..08a33bde8 100644 --- a/config/locales/budgets.es.yml +++ b/config/locales/budgets.es.yml @@ -22,6 +22,8 @@ es: groups: show: title: Selecciona una opción + unfeasible_title: Propuestas inviables + unfeasible: Ver propuestas inviables phase: accepting: Aceptando propuestas reviewing: Revisando propuestas @@ -103,3 +105,5 @@ es: show: group: Grupo phase: Fase actual + unfeasible_title: Propuestas inviables + unfeasible: Ver las propuestas inviables From 56694debfd068f4b86dec455daa8d45a5c0109cb Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 16 Jan 2017 18:49:19 +0100 Subject: [PATCH 3/9] removes duplicated social buttons on investment show --- .../investments/_investment_show.html.erb | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb index fad11d0f0..17abf4faf 100644 --- a/app/views/budgets/investments/_investment_show.html.erb +++ b/app/views/budgets/investments/_investment_show.html.erb @@ -53,8 +53,8 @@ <% end %> - <% if investment.should_show_aside? %> -
<%= t('budgets.show.group') %>