Extract methods in ballot component
Assigning variables in the view makes the code harder to read.
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="row ballot">
|
<div class="row ballot">
|
||||||
<% ballot_groups = ballot.groups.sort_by_name %>
|
|
||||||
<% ballot_groups.each do |group| %>
|
<% ballot_groups.each do |group| %>
|
||||||
<% heading = ballot.heading_for_group(group) %>
|
<% heading = ballot.heading_for_group(group) %>
|
||||||
<div id="<%= dom_id(group) %>" class="small-12 medium-6 column end">
|
<div id="<%= dom_id(group) %>" class="small-12 medium-6 column end">
|
||||||
@@ -46,7 +45,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% no_balloted_groups = budget.groups.sort_by_name - ballot_groups %>
|
|
||||||
<% no_balloted_groups.each do |group| %>
|
<% no_balloted_groups.each do |group| %>
|
||||||
<div id="<%= dom_id(group) %>" class="small-12 medium-6 column end">
|
<div id="<%= dom_id(group) %>" class="small-12 medium-6 column end">
|
||||||
<div class="margin-top ballot-content">
|
<div class="margin-top ballot-content">
|
||||||
|
|||||||
@@ -8,4 +8,14 @@ class Budgets::Ballot::BallotComponent < ApplicationComponent
|
|||||||
def budget
|
def budget
|
||||||
ballot.budget
|
ballot.budget
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def ballot_groups
|
||||||
|
ballot.groups.sort_by_name
|
||||||
|
end
|
||||||
|
|
||||||
|
def no_balloted_groups
|
||||||
|
budget.groups.sort_by_name - ballot.groups
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user