From 6beb11f0a981cc107cb695f593877751530ee263 Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Fri, 10 May 2019 13:13:11 +0200 Subject: [PATCH] Show completed progress bar for successful proposals Show a completed progress bar with total supports intead of showing a message telling the proposal has reached the needed supports. --- app/helpers/proposals_helper.rb | 4 ++-- app/views/proposals/_proposal.html.erb | 12 ++++++------ app/views/proposals/show.html.erb | 6 +++--- spec/features/proposal_ballots_spec.rb | 8 ++++---- spec/features/proposals_spec.rb | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/helpers/proposals_helper.rb b/app/helpers/proposals_helper.rb index 9f0b36815..3ce853dfa 100644 --- a/app/helpers/proposals_helper.rb +++ b/app/helpers/proposals_helper.rb @@ -83,8 +83,8 @@ module ProposalsHelper link_to button_text, path, remote: true, method: :patch, class: html_class end - def css_for_proposal_info_row - if feature?(:allow_images) + def css_for_proposal_info_row(proposal) + if proposal.image.present? if params[:selected].present? "small-12 medium-9 column" else diff --git a/app/views/proposals/_proposal.html.erb b/app/views/proposals/_proposal.html.erb index bad37f0ee..496f0f4a1 100644 --- a/app/views/proposals/_proposal.html.erb +++ b/app/views/proposals/_proposal.html.erb @@ -12,10 +12,10 @@ alt: proposal.image.title.unicode_normalize %> -
+
<% else %>
-
+
<% end %>
<% cache [locale_and_user_status(proposal), "index", proposal, proposal.author] do %> @@ -66,10 +66,10 @@
<% if proposal.successful? %> -
-

- <%= t("proposals.proposal.successful") %> -

+
+
+ <%= render "proposals/supports", proposal: proposal %> +
<% elsif proposal.archived? %>
diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index e3b25a52d..c662740b9 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -80,9 +80,9 @@

<%= t('.draft') %>

<% elsif @proposal.successful? %> -

- <%= t("proposals.proposal.successful") %> -

+
+ <%= render "supports", proposal: @proposal %> +
<% elsif @proposal.archived? %>

diff --git a/spec/features/proposal_ballots_spec.rb b/spec/features/proposal_ballots_spec.rb index d67585a7c..5a8f12db6 100644 --- a/spec/features/proposal_ballots_spec.rb +++ b/spec/features/proposal_ballots_spec.rb @@ -9,8 +9,8 @@ feature "Proposal ballots" do visit proposals_path successful_proposals.each do |proposal| - within("#proposal_#{proposal.id}_votes") do - expect(page).to have_content "This proposal has reached the required supports" + within("#proposal_#{proposal.id}_votes .supports .progress") do + expect(page).to have_content "100% / 100%" end end end @@ -20,8 +20,8 @@ feature "Proposal ballots" do successful_proposals.each do |proposal| visit proposal_path(proposal) - within("#proposal_#{proposal.id}_votes") do - expect(page).to have_content "This proposal has reached the required supports" + within("#proposal_#{proposal.id}_votes .supports .progress") do + expect(page).to have_content "100% / 100%" end end end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 2e58a60c2..3861680a4 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -1773,8 +1773,8 @@ feature "Successful proposals" do successful_proposals.each do |proposal| within("#proposal_#{proposal.id}_votes") do - expect(page).not_to have_css(".supports") - expect(page).to have_content "This proposal has reached the required supports" + expect(page).not_to have_link "Support" + expect(page).to have_content "100% / 100%" end end end @@ -1785,8 +1785,8 @@ feature "Successful proposals" do successful_proposals.each do |proposal| visit proposal_path(proposal) within("#proposal_#{proposal.id}_votes") do - expect(page).not_to have_css(".supports") - expect(page).to have_content "This proposal has reached the required supports" + expect(page).not_to have_link "Support" + expect(page).to have_content "100% / 100%" end end end