adds budget results

This commit is contained in:
rgarcia
2017-05-19 14:00:12 +02:00
parent f0d7acd087
commit ed5a1cecbb
11 changed files with 252 additions and 3 deletions

View File

@@ -0,0 +1,76 @@
<div class="small-12 medium-10 column" id="results-container">
<h2 class="inline-block">
<%= heading.name %>
</h2>
<span class="float-right">
<%= 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")} %>
</span>
<table id="budget-investments-results">
<thead>
<tr>
<th scope="col">
<%= t("budgets.results.spending_proposal") %>
</th>
<th scope="col" class="text-right">
<%= t("budgets.results.ballot_lines_count") %>
</th>
<th scope="col" class="text-right">
<%= t("budgets.results.price") %>
</th>
<th scope="col" class="text-right"
title="<%= t("budgets.results.amount_available") %>"
style="width:120px">
<%= format_price(heading.price) %>
</th>
</tr>
</thead>
<tbody>
<% amount_available = heading.price %>
<% @result.investments.each do |investment| %>
<% if investment.winner? %>
<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>
<% if investment.winner? %>
<span class="icon-check">
<span class="sr-only">
<%= t("budgets.results.accepted") %>
</span>
</span>
<% else %>
<span class="icon-x">
<span class="sr-only">
<%= t("budgets.results.discarded") %>
</span>
</span>
<% end %>
<%= link_to investment.title,
budget_investment_path(@budget, investment) %>
</td>
<td class="text-right">
<%= investment.ballot_lines_count %>
</td>
<td class="text-right" style="width:100px">
<%= format_price investment.price %>
</td>
<td class="small text-right"
title="<%= format_price(amount_available) %> - <%= format_price(investment.price) %>">
<%= format_price amount_available - investment.price %>
<% amount_available -= investment.price if investment.winner? %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,50 @@
<% provide :title, t("budgets.results.page_title") %>
<div class="expanded spending-proposals results no-margin-top">
<div class="row">
<div class="small-12 column padding text-center">
<%= link_to budgets_path, class: "left back" do %>
<i class="icon-angle-left"></i>
<%= t("shared.back") %>
<% end %>
<h1 class="title">
<%= t("budgets.results.heading") %>
</h1>
</div>
</div>
</div>
<div class="row margin-top">
<div class="small-12 column">
<ul class="tabs">
<li class="tabs-title is-active">
<span class="sr-only">
<%= t("shared.you_are_in") %>
</span>
<%= link_to t("budgets.results.results_link"), "#", class: "is-active" %>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="small-12 medium-2 column">
<ul class="menu vertical no-padding">
<li>
<strong>
<%= t("budgets.results.geozone_selection_title") %>
</strong>
</li>
<% @budget.headings.each do |heading| %>
<li>
<%= link_to content_tag(:strong, heading.name),
budget_results_path(@budget, heading_id: heading.id) %>
</li>
<% end %>
</ul>
</div>
<%= render 'results_table', heading: @result.heading %>
</div>