From db774e3fd2b2ab28edcf091e588aa535f3b44219 Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Fri, 10 May 2019 13:11:58 +0200 Subject: [PATCH] Extract proposal supports progress bar to a partial --- app/views/proposals/_supports.html.erb | 16 ++++++++++++++++ app/views/proposals/_votes.html.erb | 17 +---------------- config/locales/en/general.yml | 1 + config/locales/es/general.yml | 1 + 4 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 app/views/proposals/_supports.html.erb diff --git a/app/views/proposals/_supports.html.erb b/app/views/proposals/_supports.html.erb new file mode 100644 index 000000000..2ff839593 --- /dev/null +++ b/app/views/proposals/_supports.html.erb @@ -0,0 +1,16 @@ +
+ + + <%= supports_percentage(proposal) %> / <%= t("proposals.proposal.total_percent") %> + +
+ + + <%= t("proposals.proposal.supports", count: proposal.total_votes) %>  + + "> + <%= t("proposals.proposal.supports_necessary", + number: number_with_delimiter(Proposal.votes_needed_for_success)) %> + + + diff --git a/app/views/proposals/_votes.html.erb b/app/views/proposals/_votes.html.erb index 908ebea84..448c9d7a3 100644 --- a/app/views/proposals/_votes.html.erb +++ b/app/views/proposals/_votes.html.erb @@ -1,20 +1,5 @@
-
- - - <%= supports_percentage(proposal) %> / <%= t("proposals.proposal.total_percent") %> - -
- - - <%= t("proposals.proposal.supports", count: proposal.total_votes) %>  - - - <%= t("proposals.proposal.supports_necessary", - number: number_with_delimiter(Proposal.votes_needed_for_success)) %> - - - + <%= render "proposals/supports", proposal: proposal %>
<% if voted_for?(@proposal_votes, proposal) %> diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 09a064b65..14408f0ca 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -440,6 +440,7 @@ en: other: "%{count} votes" zero: No votes supports_necessary: "%{number} supports needed" + reason_for_supports_necessary: "" total_percent: 100% archived: "This proposal has been archived and can't collect supports." successful: "This proposal has reached the required supports." diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index e8c555ab7..25cc13d62 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -440,6 +440,7 @@ es: one: 1 voto other: "%{count} votos" supports_necessary: "%{number} apoyos necesarios" + reason_for_supports_necessary: "" total_percent: 100% archived: "Esta propuesta ha sido archivada y ya no puede recoger apoyos." successful: "Esta propuesta ha alcanzado los apoyos necesarios."