Extract method to get support confirmation message

This commit is contained in:
Javi Martín
2021-06-12 03:27:23 +02:00
parent cd8fa606c7
commit 791e8b61ec
2 changed files with 5 additions and 2 deletions

View File

@@ -15,8 +15,7 @@
title: t("budgets.investments.investment.support_title"),
method: "post",
remote: !display_support_alert?,
data: (display_support_alert? ? {
confirm: t("budgets.investments.investment.confirm_group", count: investment.group.max_votable_headings) } : nil),
data: ({ confirm: confirm_vote_message } if display_support_alert?),
"aria-hidden" => css_for_aria_hidden do %>
<%= t("budgets.investments.investment.give_support") %>
<% end %>

View File

@@ -29,6 +29,10 @@ class Budgets::Investments::VotesComponent < ApplicationComponent
investment.group.headings.count > 1
end
def confirm_vote_message
t("budgets.investments.investment.confirm_group", count: investment.group.max_votable_headings)
end
def css_for_aria_hidden
reason.present? ? "true" : ""
end