Files
grecia/app/components/proposals/votes_component.rb
Javi Martín 4fd99e2d30 Add proposal name to vote links aria-label
This way blind screen reader users will know which proposal they're
supporting. In a list of proposals, context might not be clear when a
link saying "Support" or "Support this proposal" is announced, but a
link saying "Support Create a monthly transport ticket" is less
ambiguous.

Just like we did with investments in commit de436e33a, we're keeping the
title attribute because when visiting a proposal page, the connection
between the "Support" link and the proposal is not as clear as it is in
the proposals index page, so it might not be clear what you're
supporting.
2022-02-21 18:47:37 +01:00

32 lines
643 B
Ruby

class Proposals::VotesComponent < ApplicationComponent
attr_reader :proposal
delegate :current_user, :link_to_verify_account, 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
private
def voted?
current_user&.voted_for?(proposal)
end
def can_vote?
proposal.votable_by?(current_user)
end
def support_aria_label
t("proposals.proposal.support_label", proposal: proposal.title)
end
def organization?
current_user&.organization?
end
end