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:
Javi Martín
2021-09-28 20:02:41 +02:00
parent b98244afd9
commit 4b42a68b6a
14 changed files with 17 additions and 64 deletions

View File

@@ -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