Add investment name to vote links aria-label

Note we're using the `budgets.investments.investment.add_label` and
`budgets.ballots.show.remove_label` internationalization keys so they're
consistent with the `budgets.investments.investment.add` and
`budgets.ballots.show.remove` keys which were already present. We aren't
unifying these keys in order to keep existing translations.
This commit is contained in:
Javi Martín
2021-09-30 21:57:01 +02:00
parent 4fd99e2d30
commit 704687dc54
5 changed files with 63 additions and 2 deletions

View File

@@ -14,7 +14,8 @@
investments_ids: investment_ids),
class: "button button-remove-support expanded",
method: :delete,
remote: true %>
remote: true,
"aria-label": remove_vote_aria_label %>
<% end %>
</div>
<% else %>
@@ -30,7 +31,8 @@
class: "button button-support expanded",
title: t("budgets.investments.investment.support_title"),
method: :post,
remote: true %>
remote: true,
"aria-label": vote_aria_label %>
<% end %>
</div>
<% end %>

View File

@@ -24,6 +24,14 @@ class Budgets::Investments::BallotComponent < ApplicationComponent
@reason ||= investment.reason_for_not_being_ballotable_by(current_user, ballot)
end
def vote_aria_label
t("budgets.investments.investment.add_label", investment: investment.title)
end
def remove_vote_aria_label
t("budgets.ballots.show.remove_label", investment: investment.title)
end
def link_to_my_heading
link_to(investment.heading.name,
budget_investments_path(budget_id: investment.budget_id,