removes investments from sidebar

This commit is contained in:
rgarcia
2016-09-09 19:37:02 +02:00
parent 24740578ff
commit 4ded0350a1
5 changed files with 80 additions and 116 deletions

View File

@@ -0,0 +1,55 @@
<div class="row ballot">
<%= render 'shared/back_link' %>
<h1 class="text-center"><%= t("budgets.ballots.show.title") %></h1>
<div class="small-12 medium-8 column small-centered text-center">
<h2>
<%= t("budgets.ballots.show.voted_html",
count: @ballot.investments.count) %>
</h2>
<p>
<small>
<%= t("budgets.ballots.show.voted_info_html") %>
</small>
</p>
</div>
<hr>
<div class="margin-top">
<% @ballot.groups.each do |group| %>
<div id="<%= dom_id(group) %>"
class="small-12 medium-6 column">
<h3 class="subtitle">
<%= group.name %> - <%= group.headings.first.name %>
</h3>
<% if @ballot.has_lines_in_group?(group) %>
<h4 class="amount-spent text-right">
<%= t("budgets.ballots.show.amount_spent") %>
<span>
<%= format_price(@budget, @ballot.amount_spent(@ballot.heading_for_group(group).id)) %>
</span>
</h4>
<% else %>
<p>
<%= t("budgets.ballots.show.zero") %><br>
<%= link_to t("budgets.ballots.show.heading_link"),
budget_investments_path(budget, heading_id: heading.id),
data: { no_turbolink: true } %>
</p>
<% end %>
<ul class="ballot-list">
<%= render partial: 'budgets/ballot/investment',
collection: @ballot.investments.by_group(group.id) %>
</ul>
<h4>
<%= t("budgets.ballots.show.remaining",
amount_city: format_price(@budget, @ballot.amount_available(@ballot.heading_for_group(group)))).html_safe %>
</h4>
</div>
<% end %>
</div>
</div>

View File

@@ -3,12 +3,12 @@
<span><%= format_price(@budget, investment.price) %></span>
<% if @budget.balloting? %>
<%# link_to budget_ballot_line_path(budget, id: investment.id),
<%= link_to budget_ballot_line_path(@budget, id: investment.id),
title: t('budgets.ballots.show.remove'),
class: "remove-investment-project",
method: :delete,
remote: true do %>
<span class="icon-x"></span>
<%# end %>
<% end %>
<% end %>
</li>

View File

@@ -1,6 +1,6 @@
$("#progress_bar").html('<%= j render("budgets/ballot/progress_bar", ballot: @ballot) %>');
$("#sidebar").html('<%= j render("spending_proposals/sidebar") %>');
// $("#ballot").html('<%# j render("ballots/ballot") %>')
$("#sidebar").html('<%= j render("budgets/investments/sidebar") %>');
$("#ballot").html('<%= j render("budgets/ballot/ballot") %>')
$("#<%= dom_id(@investment) %>_ballot").html('<%= j render("budgets/investments/ballot", investment: @investment) %>');
<%= render 'refresh_ballots' %>

View File

@@ -1,57 +1,3 @@
<div id="ballot">
<div class="row ballot">
<%= render 'shared/back_link' %>
<h1 class="text-center"><%= t("budgets.ballots.show.title") %></h1>
<div class="small-12 medium-8 column small-centered text-center">
<h2>
<%= t("budgets.ballots.show.voted_html",
count: @ballot.investments.count) %>
</h2>
<p>
<small>
<%= t("budgets.ballots.show.voted_info_html") %>
</small>
</p>
</div>
<hr>
<div class="margin-top">
<% @ballot.groups.each do |group| %>
<div id="<%= dom_id(group) %>"
class="small-12 medium-6 column">
<h3 class="subtitle">
<%= group.name %> - <%= group.headings.first.name %>
</h3>
<% if @ballot.has_lines_in_group?(group) %>
<h4 class="amount-spent text-right">
<%= t("budgets.ballots.show.amount_spent") %>
<span>
<%= format_price(@budget, @ballot.amount_spent(@ballot.heading_for_group(group).id)) %>
</span>
</h4>
<% else %>
<p>
<%= t("budgets.ballots.show.zero") %><br>
<%= link_to t("budgets.ballots.show.heading_link"),
budget_investments_path(budget, heading_id: heading.id),
data: { no_turbolink: true } %>
</p>
<% end %>
<ul class="ballot-list">
<%= render partial: 'budgets/ballot/investment',
collection: @ballot.investments.by_group(group.id) %>
</ul>
<h4>
<%= t("budgets.ballots.show.remaining",
amount_city: format_price(@budget, @ballot.amount_available(@ballot.heading_for_group(group)))).html_safe %>
</h4>
</div>
<% end %>
</div>
</div>
<%= render "budgets/ballot/ballot" %>
</div>