diff --git a/app/controllers/budgets/results_controller.rb b/app/controllers/budgets/results_controller.rb index d92232f67..8da1e9ef7 100644 --- a/app/controllers/budgets/results_controller.rb +++ b/app/controllers/budgets/results_controller.rb @@ -5,7 +5,8 @@ module Budgets def show authorize! :read_results, @budget - @result = load_result + @investments = load_result.investments + @heading = heading end private @@ -19,4 +20,4 @@ module Budgets end end -end \ No newline at end of file +end diff --git a/app/views/budgets/results/_results_table.html.erb b/app/views/budgets/results/_results_table.html.erb index 9c40a1d22..993060562 100644 --- a/app/views/budgets/results/_results_table.html.erb +++ b/app/views/budgets/results/_results_table.html.erb @@ -1,14 +1,10 @@ -
+
+

- <%= heading.name %> + <%= title %>

- <%= link_to t("budgets.results.show_all_link"), "#", - class: "js-toggle-link button hollow margin-bottom float-right", - data: {'toggle-selector' => '.js-discarded', - 'toggle-text' => t("budgets.results.hide_discarded_link")} %> - - +
- + <% if results_type == :compatible %> + + <% end %> - <% amount_available = heading.price %> - <% @result.investments.each do |investment| %> - <% if investment.winner? %> - - <% else %> - - <% end %> + <% amount_available = heading_price %> + <% investments.each do |investment| %> + - + <% if results_type == :compatible %> + + <% end %> <% end %> diff --git a/app/views/budgets/results/show.html.erb b/app/views/budgets/results/show.html.erb index d9253b785..2343e652c 100644 --- a/app/views/budgets/results/show.html.erb +++ b/app/views/budgets/results/show.html.erb @@ -1,6 +1,6 @@ <% provide :title, t("budgets.results.page_title", budget: @budget.name) %> <% content_for :canonical do %> - <%= render "shared/canonical", href: budget_results_url(@budget, heading_id: @result.heading) %> + <%= render "shared/canonical", href: budget_results_url(@budget, heading_id: @heading) %> <% end %>
@@ -34,5 +34,16 @@
- <%= render 'results_table', heading: @result.heading %> + <%= link_to t("budgets.results.hide_discarded_link"), "#", class: "js-toggle-link button hollow margin-bottom", data: {'toggle-selector' => '.js-discarded', 'toggle-text' => t("budgets.results.show_all_link")} %> + + + <%= render 'results_table', results_type: :compatible, + title: @heading.name, + heading_price: @heading.price, + investments: @investments.compatible %> + + <%= render 'results_table', results_type: :incompatible, + title: t("budgets.results.incompatibles"), + heading_price: @heading.price, + investments: @investments.incompatible %> diff --git a/config/locales/budgets.en.yml b/config/locales/budgets.en.yml index 75a56c919..33ef8bb80 100644 --- a/config/locales/budgets.en.yml +++ b/config/locales/budgets.en.yml @@ -136,3 +136,4 @@ en: amount_available: Available budget accepted: "Accepted spending proposal: " discarded: "Discarded spending proposal: " + incompatibles: Incompatibles diff --git a/config/locales/budgets.es.yml b/config/locales/budgets.es.yml index 4c35d8902..029c0277a 100644 --- a/config/locales/budgets.es.yml +++ b/config/locales/budgets.es.yml @@ -136,3 +136,5 @@ es: amount_available: Presupuesto disponible accepted: "Propuesta de inversión aceptada: " discarded: "Propuesta de inversión descartada: " + incompatibles: Incompatibles +
@@ -20,23 +16,19 @@ <%= t("budgets.results.price") %> - <%= format_price(heading.price) %>
- <%= t("budgets.results.amount_available") %> -
+ <%= format_price(heading_price) %>
+ <%= t("budgets.results.amount_available") %> +
<% if investment.winner? %> @@ -51,8 +43,7 @@ <% end %> - <%= link_to investment.title, - budget_investment_path(@budget, investment) %> + <%= link_to investment.title, budget_investment_path(@budget, investment) %> <%= investment.ballot_lines_count %> @@ -60,11 +51,13 @@ <%= format_price investment.price %> - <%= format_price amount_available - investment.price %> - <% amount_available -= investment.price if investment.winner? %> - + <%= format_price amount_available - investment.price %> + <% amount_available -= investment.price if investment.winner? %> +