diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index b4ea0cca3..30aaf1bfd 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -226,6 +226,11 @@ a { a { color: $text-medium; padding: 0; + + &.active { + font-weight: bold; + color: $brand; + } } h2 { @@ -236,11 +241,6 @@ a { border-bottom: 2px solid $brand; color: $brand; } - - &.bold { - font-weight: bold; - color: $brand; - } } &.no-margin-top { diff --git a/app/controllers/budgets/results_controller.rb b/app/controllers/budgets/results_controller.rb index 96f52b8ca..40586ed96 100644 --- a/app/controllers/budgets/results_controller.rb +++ b/app/controllers/budgets/results_controller.rb @@ -7,25 +7,21 @@ module Budgets def show authorize! :read_results, @budget - @investments = load_result.investments + @investments = Budget::Result.new(@budget, @heading).investments end private - def load_result - Budget::Result.new(@budget, @heading) - end - def load_budget @budget = Budget.find_by(id: params[:budget_id]) end def load_heading - if params[:heading_id].present? - @heading = @budget.headings.find(params[:heading_id]) - else - @heading = @budget.headings.first - end + @heading = if params[:heading_id].present? + @budget.headings.find(params[:heading_id]) + else + @budget.headings.first + end end end diff --git a/app/views/budgets/results/_results_table.html.erb b/app/views/budgets/results/_results_table.html.erb index f391e8d50..e7cfadaff 100644 --- a/app/views/budgets/results/_results_table.html.erb +++ b/app/views/budgets/results/_results_table.html.erb @@ -1,4 +1,4 @@ -
@@ -20,8 +20,8 @@ <% if results_type == :compatible %> + <%= t("budgets.results.amount_available") %>
<%= format_price(heading_price) %>
- <%= t("budgets.results.amount_available") %> <% end %> diff --git a/app/views/budgets/results/show.html.erb b/app/views/budgets/results/show.html.erb index 0733b6ce1..a566b32d4 100644 --- a/app/views/budgets/results/show.html.erb +++ b/app/views/budgets/results/show.html.erb @@ -10,37 +10,49 @@ <%= render "shared/canonical", href: budget_results_url(@budget) %> <% end %> -
-
-
- <%= back_link_to budget_path(@budget) %> - -

- <%= @budget.name %>
- <%= t("budgets.results.heading") %> -

+
+
+
+
+ <%= back_link_to budget_path(@budget) %> +

<%= t("budgets.results.heading") %>
<%= @budget.name %>

+
-
-
+ +
+
+
+ +
+
<%= link_to t("budgets.results.show_all_link"), "#", class: "js-toggle-link button hollow margin-bottom", data: {'toggle-selector' => '.js-discarded', 'toggle-text' => t("budgets.results.hide_discarded_link")} %> diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml index 33ef8bb80..a6b9fbc19 100644 --- a/config/locales/en/budgets.yml +++ b/config/locales/en/budgets.yml @@ -125,9 +125,10 @@ en: unselected: See investments not selected for balloting phase see_results: See results results: + link: Results page_title: "%{budget} - Results" heading: "Participatory budget results" - geozone_selection_title: "By district" + heading_selection_title: "By district" spending_proposal: Proposal title ballot_lines_count: Times selected hide_discarded_link: Hide discarded diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml index 029c0277a..6d80f0a51 100644 --- a/config/locales/es/budgets.yml +++ b/config/locales/es/budgets.yml @@ -125,9 +125,10 @@ es: unselected: Ver las propuestas no seleccionadas para la votación final see_results: Ver resultados results: + link: Resultados page_title: "%{budget} - Resultados" heading: "Resultados presupuestos participativos" - geozone_selection_title: "Ámbito de actuación" + heading_selection_title: "Ámbito de actuación" spending_proposal: Título ballot_lines_count: Votos hide_discarded_link: Ocultar descartadas @@ -137,4 +138,3 @@ es: accepted: "Propuesta de inversión aceptada: " discarded: "Propuesta de inversión descartada: " incompatibles: Incompatibles - diff --git a/spec/features/budgets/results_spec.rb b/spec/features/budgets/results_spec.rb index 32bcc3912..62b74d321 100644 --- a/spec/features/budgets/results_spec.rb +++ b/spec/features/budgets/results_spec.rb @@ -14,9 +14,13 @@ feature 'Results' do let!(:results) { Budget::Result.new(budget, heading).calculate_winners } scenario "Diplays winner investments" do + create(:budget_heading, group: group) + visit budget_path(budget) click_link "See results" + expect(page).to have_selector('a.active', text: budget.headings.first.name) + within("#budget-investments-compatible") do expect(page).to have_content investment1.title expect(page).to have_content investment2.title