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.
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
class Proposals::VotesComponent < ApplicationComponent
|
||||
attr_reader :proposal, :vote_url
|
||||
attr_reader :proposal
|
||||
delegate :current_user, :link_to_verify_account, :user_signed_in?, to: :helpers
|
||||
|
||||
def initialize(proposal, vote_url:)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user