Use keyword arguments in tag methods

The interface of this method has changed and uses keyword arguments
instead of a hash of options. This change will be particularly
significant when upgrading to Ruby 3.
This commit is contained in:
Javi Martín
2021-09-19 16:14:34 +02:00
parent 0b613158da
commit 790170a27c
6 changed files with 7 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
<%= tag.table options do %>
<%= tag.table(**options) do %>
<thead>
<tr>
<th><%= t("admin.poll_officers.officer.name") %></th>

View File

@@ -1,5 +1,5 @@
<div class="small-12 medium-4 column">
<%= tag.p(options) do %>
<%= tag.p(**options) do %>
<%= text %> <br><span class="number"><%= amount %></span>
<% end %>
</div>

View File

@@ -1 +1 @@
<%= tag.ul(options) { safe_join(list_items, "\n") } %>
<%= tag.ul(**options) { safe_join(list_items, "\n") } %>

View File

@@ -18,7 +18,7 @@ class Shared::LinkListComponent < ApplicationComponent
def list_items
present_links.map do |text, url, current = false, **link_options|
tag.li(({ "aria-current": true } if current)) do
tag.li("aria-current": (true if current)) do
if url
link_to text, url, link_options
else

View File

@@ -2,7 +2,7 @@ module StatsHelper
def chart_tag(opt = {})
opt[:data] ||= {}
opt[:data][:graph] = admin_api_stats_path(chart_data(opt))
tag.div opt
tag.div(**opt)
end
def chart_data(opt = {})
@@ -26,7 +26,7 @@ module StatsHelper
def budget_investments_chart_tag(opt = {})
opt[:data] ||= {}
opt[:data][:graph] = admin_api_stats_path(budget_investments: true)
tag.div opt
tag.div(**opt)
end
def number_to_stats_percentage(number, options = {})

View File

@@ -32,7 +32,7 @@ module TranslatableFormHelper
def fields_for_locale(locale)
fields_for_translation(@translations[locale]) do |translations_form|
@template.tag.div translations_options(translations_form.object, locale) do
@template.tag.div **translations_options(translations_form.object, locale) do
@template.concat translations_form.hidden_field(
:_destroy,
value: !@template.enabled_locale?(translations_form.object.globalized_model, locale),