Add to public Budget Results page winners, discarded and incompatible listing
This commit is contained in:
@@ -5,7 +5,8 @@ module Budgets
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
authorize! :read_results, @budget
|
authorize! :read_results, @budget
|
||||||
@result = load_result
|
@investments = load_result.investments
|
||||||
|
@heading = heading
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
<div class="small-12 medium-9 column" id="results-container">
|
<div class="small-12 medium-9 column <%= results_type == :compatible ? 'success' : 'js-discarded' %>" id="<%= results_type %>-container">
|
||||||
|
|
||||||
<h3 class="inline-block">
|
<h3 class="inline-block">
|
||||||
<%= heading.name %>
|
<%= title %>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<%= link_to t("budgets.results.show_all_link"), "#",
|
<table id="budget-investments-<%= results_type %>" class="table-for-mobile">
|
||||||
class: "js-toggle-link button hollow margin-bottom float-right",
|
|
||||||
data: {'toggle-selector' => '.js-discarded',
|
|
||||||
'toggle-text' => t("budgets.results.hide_discarded_link")} %>
|
|
||||||
|
|
||||||
<table id="budget-investments-results" class="table-for-mobile">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
@@ -20,23 +16,19 @@
|
|||||||
<th scope="col" class="text-center">
|
<th scope="col" class="text-center">
|
||||||
<%= t("budgets.results.price") %>
|
<%= t("budgets.results.price") %>
|
||||||
</th>
|
</th>
|
||||||
<th scope="col" class="text-right">
|
<% if results_type == :compatible %>
|
||||||
<%= format_price(heading.price) %><br>
|
<th scope="col" class="text-right">
|
||||||
<small><%= t("budgets.results.amount_available") %></small>
|
<%= format_price(heading_price) %><br>
|
||||||
</th>
|
<small><%= t("budgets.results.amount_available") %></small>
|
||||||
|
</th>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<% amount_available = heading.price %>
|
<% amount_available = heading_price %>
|
||||||
<% @result.investments.each do |investment| %>
|
<% investments.each do |investment| %>
|
||||||
<% if investment.winner? %>
|
<tr id="<%= dom_id(investment) %>" class="budget-investments <%= investment.winner? ? 'success' : 'js-discarded' %>">
|
||||||
<tr id="<%= dom_id(investment) %>"
|
|
||||||
class="spending_proposal success">
|
|
||||||
<% else %>
|
|
||||||
<tr id="<%= dom_id(investment) %>"
|
|
||||||
class="spending_proposal js-discarded" style="display:none">
|
|
||||||
<% end %>
|
|
||||||
<td>
|
<td>
|
||||||
<% if investment.winner? %>
|
<% if investment.winner? %>
|
||||||
<span class="icon-check">
|
<span class="icon-check">
|
||||||
@@ -51,8 +43,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to investment.title,
|
<%= link_to investment.title, budget_investment_path(@budget, investment) %>
|
||||||
budget_investment_path(@budget, investment) %>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<%= investment.ballot_lines_count %>
|
<%= investment.ballot_lines_count %>
|
||||||
@@ -60,11 +51,13 @@
|
|||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<%= format_price investment.price %>
|
<%= format_price investment.price %>
|
||||||
</td>
|
</td>
|
||||||
<td class="small text-right"
|
<% if results_type == :compatible %>
|
||||||
title="<%= format_price(amount_available) %> - <%= format_price(investment.price) %>">
|
<td class="small text-right"
|
||||||
<%= format_price amount_available - investment.price %>
|
title="<%= format_price(amount_available) %> - <%= format_price(investment.price) %>">
|
||||||
<% amount_available -= investment.price if investment.winner? %>
|
<%= format_price amount_available - investment.price %>
|
||||||
</td>
|
<% amount_available -= investment.price if investment.winner? %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<% provide :title, t("budgets.results.page_title", budget: @budget.name) %>
|
<% provide :title, t("budgets.results.page_title", budget: @budget.name) %>
|
||||||
<% content_for :canonical do %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<div class="expanded budget no-margin-top">
|
<div class="expanded budget no-margin-top">
|
||||||
@@ -34,5 +34,16 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render 'results_table', heading: @result.heading %>
|
<span class="float-right"><%= 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")} %></span>
|
||||||
|
|
||||||
|
|
||||||
|
<%= 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 %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -136,3 +136,4 @@ en:
|
|||||||
amount_available: Available budget
|
amount_available: Available budget
|
||||||
accepted: "Accepted spending proposal: "
|
accepted: "Accepted spending proposal: "
|
||||||
discarded: "Discarded spending proposal: "
|
discarded: "Discarded spending proposal: "
|
||||||
|
incompatibles: Incompatibles
|
||||||
|
|||||||
@@ -136,3 +136,5 @@ es:
|
|||||||
amount_available: Presupuesto disponible
|
amount_available: Presupuesto disponible
|
||||||
accepted: "Propuesta de inversión aceptada: "
|
accepted: "Propuesta de inversión aceptada: "
|
||||||
discarded: "Propuesta de inversión descartada: "
|
discarded: "Propuesta de inversión descartada: "
|
||||||
|
incompatibles: Incompatibles
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user