Add votable name to agree/disagree links aria-label
This commit is contained in:
@@ -2,7 +2,11 @@
|
|||||||
<div class="in-favor inline-block">
|
<div class="in-favor inline-block">
|
||||||
<% if current_user %>
|
<% if current_user %>
|
||||||
<%= link_to polymorphic_path(votable, action: :vote, value: "yes"),
|
<%= link_to polymorphic_path(votable, action: :vote, value: "yes"),
|
||||||
class: "like #{voted_classes[:in_favor]}", title: t("votes.agree"), method: "post", remote: true do %>
|
class: "like #{voted_classes[:in_favor]}",
|
||||||
|
title: t("votes.agree"),
|
||||||
|
"aria-label": agree_aria_label,
|
||||||
|
method: "post",
|
||||||
|
remote: true do %>
|
||||||
<span class="icon-like">
|
<span class="icon-like">
|
||||||
<span class="show-for-sr"><%= t("votes.agree") %></span>
|
<span class="show-for-sr"><%= t("votes.agree") %></span>
|
||||||
</span>
|
</span>
|
||||||
@@ -22,7 +26,12 @@
|
|||||||
|
|
||||||
<div class="against inline-block">
|
<div class="against inline-block">
|
||||||
<% if current_user %>
|
<% if current_user %>
|
||||||
<%= link_to polymorphic_path(votable, action: :vote, value: "no"), class: "unlike #{voted_classes[:against]}", title: t("votes.disagree"), method: "post", remote: true do %>
|
<%= link_to polymorphic_path(votable, action: :vote, value: "no"),
|
||||||
|
class: "unlike #{voted_classes[:against]}",
|
||||||
|
title: t("votes.disagree"),
|
||||||
|
"aria-label": disagree_aria_label,
|
||||||
|
method: "post",
|
||||||
|
remote: true do %>
|
||||||
<span class="icon-unlike">
|
<span class="icon-unlike">
|
||||||
<span class="show-for-sr"><%= t("votes.disagree") %></span>
|
<span class="show-for-sr"><%= t("votes.disagree") %></span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -22,4 +22,12 @@ class Shared::InFavorAgainstComponent < ApplicationComponent
|
|||||||
{ in_favor: "", against: "" }
|
{ in_favor: "", against: "" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def agree_aria_label
|
||||||
|
t("votes.agree_label", title: votable.title)
|
||||||
|
end
|
||||||
|
|
||||||
|
def disagree_aria_label
|
||||||
|
t("votes.disagree_label", title: votable.title)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -847,9 +847,11 @@ en:
|
|||||||
retired_help_text: Dashboard not available for retired proposals
|
retired_help_text: Dashboard not available for retired proposals
|
||||||
votes:
|
votes:
|
||||||
agree: I agree
|
agree: I agree
|
||||||
|
agree_label: "I agree with %{title}"
|
||||||
anonymous: Too many anonymous votes to admit vote %{verify_account}.
|
anonymous: Too many anonymous votes to admit vote %{verify_account}.
|
||||||
comment_unauthenticated: You must %{signin} or %{signup} to vote.
|
comment_unauthenticated: You must %{signin} or %{signup} to vote.
|
||||||
disagree: I disagree
|
disagree: I disagree
|
||||||
|
disagree_label: "I don't agree with %{title}"
|
||||||
organizations: Organizations are not permitted to vote
|
organizations: Organizations are not permitted to vote
|
||||||
supports: Supports
|
supports: Supports
|
||||||
verified_only: Only verified users can vote on proposals; %{verify_account}.
|
verified_only: Only verified users can vote on proposals; %{verify_account}.
|
||||||
|
|||||||
@@ -847,9 +847,11 @@ es:
|
|||||||
retired_help_text: Dashboard no disponible para propuestas retiradas
|
retired_help_text: Dashboard no disponible para propuestas retiradas
|
||||||
votes:
|
votes:
|
||||||
agree: Estoy de acuerdo
|
agree: Estoy de acuerdo
|
||||||
|
agree_label: "Estoy de acuerdo con %{title}"
|
||||||
anonymous: Demasiados votos anónimos, para poder votar %{verify_account}.
|
anonymous: Demasiados votos anónimos, para poder votar %{verify_account}.
|
||||||
comment_unauthenticated: Necesitas %{signin} o %{signup} para poder votar.
|
comment_unauthenticated: Necesitas %{signin} o %{signup} para poder votar.
|
||||||
disagree: No estoy de acuerdo
|
disagree: No estoy de acuerdo
|
||||||
|
disagree_label: "No estoy de acuerdo con %{title}"
|
||||||
organizations: Las organizaciones no pueden votar.
|
organizations: Las organizaciones no pueden votar.
|
||||||
supports: Apoyos
|
supports: Apoyos
|
||||||
verified_only: Las propuestas sólo pueden ser votadas por usuarios verificados, %{verify_account}.
|
verified_only: Las propuestas sólo pueden ser votadas por usuarios verificados, %{verify_account}.
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ describe Debates::VotesComponent do
|
|||||||
|
|
||||||
expect(page).to have_link count: 2
|
expect(page).to have_link count: 2
|
||||||
expect(page).to have_link "I agree", title: "I agree"
|
expect(page).to have_link "I agree", title: "I agree"
|
||||||
|
expect(page).to have_link "I agree with What about the 2030 agenda?"
|
||||||
expect(page).to have_link "I disagree", title: "I disagree"
|
expect(page).to have_link "I disagree", title: "I disagree"
|
||||||
|
expect(page).to have_link "I don't agree with What about the 2030 agenda?"
|
||||||
expect(page).not_to have_content "You must sign in or sign up to continue."
|
expect(page).not_to have_content "You must sign in or sign up to continue."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ describe Legislation::Proposals::VotesComponent do
|
|||||||
|
|
||||||
expect(page).to have_link count: 2
|
expect(page).to have_link count: 2
|
||||||
expect(page).to have_link "I agree", title: "I agree"
|
expect(page).to have_link "I agree", title: "I agree"
|
||||||
|
expect(page).to have_link "I agree with Require wearing masks at home"
|
||||||
expect(page).to have_link "I disagree", title: "I disagree"
|
expect(page).to have_link "I disagree", title: "I disagree"
|
||||||
|
expect(page).to have_link "I don't agree with Require wearing masks at home"
|
||||||
expect(page).not_to have_content "You must sign in or sign up to continue."
|
expect(page).not_to have_content "You must sign in or sign up to continue."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user