Move votes partials to components
We're going to change the code quite a bit, and with components we can easily extract methods when necessary.
This commit is contained in:
9
app/components/legislation/proposals/votes_component.rb
Normal file
9
app/components/legislation/proposals/votes_component.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class Legislation::Proposals::VotesComponent < ApplicationComponent
|
||||
attr_reader :proposal, :legislation_proposal_votes
|
||||
delegate :css_classes_for_vote, :current_user, :link_to_verify_account, :user_signed_in?, :voted_for?, :votes_percentage, to: :helpers
|
||||
|
||||
def initialize(proposal, legislation_proposal_votes:)
|
||||
@proposal = proposal
|
||||
@legislation_proposal_votes = legislation_proposal_votes
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user