Use local variables in progress bar partial

We were even passing the `ballot` local variable in some places, which
was ignored because we were using instace variables.
This commit is contained in:
Javi Martín
2020-07-29 14:12:28 +02:00
parent 8edcbcfd3b
commit 2216cb91d1
4 changed files with 9 additions and 9 deletions

View File

@@ -1,24 +1,24 @@
<span class="total-amount">
<%= sanitize(@ballot.amount_limit_info(@heading)) %>
<%= sanitize(ballot.amount_limit_info(heading)) %>
</span>
<div class="progress" role="progressbar" tabindex="0"
id="progress"
aria-valuenow="<%= @ballot.percentage_spent(@heading) %>" aria-valuemin="0" aria-valuemax="100">
aria-valuenow="<%= ballot.percentage_spent(heading) %>" aria-valuemin="0" aria-valuemax="100">
<div class="progress-meter"
style="width: <%= @ballot.percentage_spent(@heading) %>%">
style="width: <%= ballot.percentage_spent(heading) %>%">
</div>
</div>
<div class="progress spent-amount-progress" role="progressbar" tabindex="0"
aria-valuenow="20" aria-valuemin="0" aria-valuetext="25 percent" aria-valuemax="100">
<span class="progress-meter spent-amount-meter"
style="width: <%= @ballot.percentage_spent(@heading) %>%">
style="width: <%= ballot.percentage_spent(heading) %>%">
<p id="amount-spent" class="progress-meter-text spent-amount-text">
<small><%= t("budgets.progress_bar.assigned") %></small><%= @ballot.formatted_amount_spent(@heading) %>
<small><%= t("budgets.progress_bar.assigned") %></small><%= ballot.formatted_amount_spent(heading) %>
<span id="amount-available" class="amount-available">
<small><%= t("budgets.progress_bar.available") %></small>
<span><%= @ballot.formatted_amount_available(@heading) %></span>
<span><%= ballot.formatted_amount_available(heading) %></span>
</span>
</p>
</span>

View File

@@ -1,4 +1,4 @@
$("#progress_bar").html("<%= j render("/budgets/ballot/progress_bar", ballot: @ballot) %>");
$("#progress_bar").html("<%= j render("/budgets/ballot/progress_bar", ballot: @ballot, heading: @heading) %>");
$("#sidebar").html("<%= j render("/budgets/investments/sidebar") %>");
<%= render "refresh_ballots",

View File

@@ -1,4 +1,4 @@
$("#progress_bar").html("<%= j render("budgets/ballot/progress_bar", ballot: @ballot) %>");
$("#progress_bar").html("<%= j render("budgets/ballot/progress_bar", ballot: @ballot, heading: @heading) %>");
$("#sidebar").html("<%= j render("budgets/investments/sidebar") %>");
$("#ballot").html("<%= j render("budgets/ballot/ballot") %>")

View File

@@ -27,7 +27,7 @@
<%= t("budgets.investments.index.by_heading", heading: @heading.name) %>
</h2>
<div id="progress_bar" class="no-margin-top">
<%= render "budgets/ballot/progress_bar" %>
<%= render "budgets/ballot/progress_bar", ballot: @ballot, heading: @heading %>
</div>
</div>
<% else %>