From 2216cb91d12ccdfcc4afad1aadeb8aad706dec5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 29 Jul 2020 14:12:28 +0200 Subject: [PATCH] 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. --- app/views/budgets/ballot/_progress_bar.html.erb | 12 ++++++------ app/views/budgets/ballot/lines/create.js.erb | 2 +- app/views/budgets/ballot/lines/destroy.js.erb | 2 +- app/views/budgets/investments/_header.html.erb | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/budgets/ballot/_progress_bar.html.erb b/app/views/budgets/ballot/_progress_bar.html.erb index a068016ba..f556ee10f 100644 --- a/app/views/budgets/ballot/_progress_bar.html.erb +++ b/app/views/budgets/ballot/_progress_bar.html.erb @@ -1,24 +1,24 @@ - <%= sanitize(@ballot.amount_limit_info(@heading)) %> + <%= sanitize(ballot.amount_limit_info(heading)) %>
+ aria-valuenow="<%= ballot.percentage_spent(heading) %>" aria-valuemin="0" aria-valuemax="100">
+ style="width: <%= ballot.percentage_spent(heading) %>%">
+ style="width: <%= ballot.percentage_spent(heading) %>%">

- <%= t("budgets.progress_bar.assigned") %><%= @ballot.formatted_amount_spent(@heading) %> + <%= t("budgets.progress_bar.assigned") %><%= ballot.formatted_amount_spent(heading) %> <%= t("budgets.progress_bar.available") %> - <%= @ballot.formatted_amount_available(@heading) %> + <%= ballot.formatted_amount_available(heading) %>

diff --git a/app/views/budgets/ballot/lines/create.js.erb b/app/views/budgets/ballot/lines/create.js.erb index e6569e69a..48e56054f 100644 --- a/app/views/budgets/ballot/lines/create.js.erb +++ b/app/views/budgets/ballot/lines/create.js.erb @@ -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", diff --git a/app/views/budgets/ballot/lines/destroy.js.erb b/app/views/budgets/ballot/lines/destroy.js.erb index 106cac60d..c93517414 100644 --- a/app/views/budgets/ballot/lines/destroy.js.erb +++ b/app/views/budgets/ballot/lines/destroy.js.erb @@ -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") %>") diff --git a/app/views/budgets/investments/_header.html.erb b/app/views/budgets/investments/_header.html.erb index a5c63f160..0b18c3e1f 100644 --- a/app/views/budgets/investments/_header.html.erb +++ b/app/views/budgets/investments/_header.html.erb @@ -27,7 +27,7 @@ <%= t("budgets.investments.index.by_heading", heading: @heading.name) %>
- <%= render "budgets/ballot/progress_bar" %> + <%= render "budgets/ballot/progress_bar", ballot: @ballot, heading: @heading %>
<% else %>