Only render successful icon on successful proposals
Not doing so made it trickier to define a flex layout, since the icon-successful element is given a `position: absolute`, but only for successful proposals, while for unsuccessful proposals it was taking the standard `position: static` value. We're also reusing the `successful?` method instead of rewriting it in the view, and fixing a small issue where the icon wasn't displayed for proposals having the exact needed votes (we were using `>` instead of `>=` in the condition). Note that legislation proposals use the method `Proposal.votes_needed_for_success`, which is probaby a mistake caused by copying the code from the proposal view. Fixing this issue is out of the scope of this commit (and pull request), though.
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
class="proposal clear <%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
|
||||
data-type="proposal">
|
||||
<div class="panel <%= ("with-image" if proposal.image.present?) %>">
|
||||
<div class="icon-successful"></div>
|
||||
<% if proposal.total_votes > Proposal.votes_needed_for_success %>
|
||||
<div class="icon-successful"></div>
|
||||
<% end %>
|
||||
|
||||
<% if proposal.image.present? %>
|
||||
<div class="row">
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<div id="<%= dom_id(proposal) %>"
|
||||
class="proposal clear
|
||||
<%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
|
||||
class="proposal clear <%= ("successful" if proposal.successful?) %>"
|
||||
data-type="proposal">
|
||||
<div class="panel <%= "with-image" if proposal.image.present? %>">
|
||||
<div class="icon-successful"></div>
|
||||
<% if proposal.successful? %>
|
||||
<div class="icon-successful"></div>
|
||||
<% end %>
|
||||
|
||||
<% if proposal.image.present? %>
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user