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>
|
||||
|
||||
<div class="row ballot">
|
||||
<% ballot_groups = ballot.groups.sort_by_name %>
|
||||
<% ballot_groups.each do |group| %>
|
||||
<% heading = ballot.heading_for_group(group) %>
|
||||
<div id="<%= dom_id(group) %>" class="small-12 medium-6 column end">
|
||||
@@ -46,7 +45,6 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% no_balloted_groups = budget.groups.sort_by_name - ballot_groups %>
|
||||
<% no_balloted_groups.each do |group| %>
|
||||
<div id="<%= dom_id(group) %>" class="small-12 medium-6 column end">
|
||||
<div class="margin-top ballot-content">
|
||||
|
||||
@@ -8,4 +8,14 @@ class Budgets::Ballot::BallotComponent < ApplicationComponent
|
||||
def budget
|
||||
ballot.budget
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ballot_groups
|
||||
ballot.groups.sort_by_name
|
||||
end
|
||||
|
||||
def no_balloted_groups
|
||||
budget.groups.sort_by_name - ballot.groups
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user