Files
nairobi/app/components/proposals/votes_component.rb
Javi Martín 4b42a68b6a Use the vote action to vote featured proposals
The action and the views were almost identical, with the supports
progress and the HTML classes of the success message element being the
only exceptions; we can use CSS for the styles instead.
2022-02-21 18:47:13 +01:00

14 lines
346 B
Ruby

class Proposals::VotesComponent < ApplicationComponent
attr_reader :proposal
delegate :current_user, :link_to_verify_account, :user_signed_in?, to: :helpers
def initialize(proposal, vote_url: nil)
@proposal = proposal
@vote_url = vote_url
end
def vote_url
@vote_url || vote_proposal_path(proposal, value: "yes")
end
end