In Rails 6.1 and earlier, `button_to` generated a <button> tag when it received the content as a block, but an <input> tag when receiving the content as the first parameter. That's why we were using blocks with `button_to` most of the time; for starters, <button> tags accept pseudocontent and so are easier to style. In Rails 7.0, `button_to` always generates a <button> tag [1], so we're simplifying the code what uses `button_to`, passing the content as a first parameter instead of passing it as a block. [1] https://guides.rubyonrails.org/v7.1/configuring.html#config-action-view-button-to-generates-button-tag
48 lines
1.9 KiB
Plaintext
48 lines
1.9 KiB
Plaintext
<div class="supports">
|
|
|
|
<span class="total-supports <%= "no-button" unless voting_allowed? || user_voted_for? %>">
|
|
<%= t("budgets.investments.investment.supports", count: investment.total_votes) %>
|
|
</span>
|
|
|
|
<div class="in-favor">
|
|
<% if investment.should_show_votes? %>
|
|
<% if user_voted_for? %>
|
|
<div class="supported">
|
|
<div class="callout success">
|
|
<%= t("budgets.investments.votes.already_supported") %>
|
|
</div>
|
|
<% if feature?(:remove_investments_supports) %>
|
|
<%= button_to t("budgets.investments.votes.remove_support"),
|
|
remove_support_path,
|
|
class: "button button-remove-support expanded",
|
|
method: "delete",
|
|
remote: true,
|
|
"aria-label": remove_support_aria_label %>
|
|
<% end %>
|
|
</div>
|
|
<% else %>
|
|
<%= button_to t("budgets.investments.votes.support"), support_path,
|
|
class: "button button-support expanded",
|
|
title: t("budgets.investments.investment.support_title"),
|
|
method: "post",
|
|
remote: !display_support_alert?,
|
|
data: ({ confirm: confirm_vote_message } if display_support_alert?),
|
|
"aria-label": support_aria_label %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= render Shared::ParticipationNotAllowedComponent.new(investment, cannot_vote_text: cannot_vote_text) %>
|
|
|
|
<% if user_voted_for? && setting["twitter_handle"] %>
|
|
<div class="share-supported">
|
|
<%= render "shared/social_share",
|
|
title: investment.title,
|
|
image_url: image_absolute_url(investment.image, :thumb),
|
|
url: budget_investment_url(investment.budget, investment),
|
|
description: investment.title,
|
|
mobile: investment.title %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|