%
%i[actions_on_multiple].each do |key|
if (content = content_for(key).presence)
flush_content_for key
partial.section key, content
end
end
%>
<%
form ||= current_fields_form
html_options ||= {}
html_options[:id] ||= form.field_id(method)
multiple ||= false
show_select_all_top ||= false
show_select_all_bottom ||= false
use_columns ||= false
other_options ||= {}
options ||= options_for(form, method)
labels = labels_for(form, method)
option_field_options ||= {}
option_field_options[:data] ||= {}
option_field_options[:data][:controller] ||= ""
option_field_options[:data][:controller] += " fields--field"
if multiple
option_field_options[:data] = option_field_options[:data].merge({
"select-all-target": 'checkbox'
})
option_field_options[:data][:action] ||= ""
option_field_options[:data][:action] += " select-all#updateToggle"
end
%>
<%#
# TODO: We should either remove this, or move the Action Models `bulk_action_select`
# partial here to bullet_train-core because this cannot work with the setup we currently have.
%>
<% if multiple && (show_select_all_top || show_select_all_bottom) %>
<% select_all = capture do %>
<%= tag.div class: [
"hidden",
"inline-block dark:border-slate-600",
"border-b pb-4 mb-4": show_select_all_top && !show_select_all_bottom,
"border-t pt-4 mt-4": !show_select_all_top && show_select_all_bottom
], data: {
"select-all-target": "wrapper"
} do %>
<% end %>
<%= partial.actions_on_multiple %>
<% end %>
<% end %>
<%= render 'shared/fields/field', form: form, method: method, options: html_options, other_options: other_options do %>
<% content_for :field do %>
<%= tag.div class: "pt-1.5 pb-1 sm:col-span-2", data: {
controller: "select-all",
"select-all-unavailable-class": "hidden"
} do %>
<% if multiple && show_select_all_top && !show_select_all_bottom %>
<%= select_all %>
<% end %>
<%= tag.div class: ["max-w-lg": !use_columns, "max-w-3xl": use_columns, "columns-[var(--column-width,_15ch)_3]": use_columns] do %>
<%= render 'shared/fields/option', method: method, form: form, option_field_options: option_field_options, multiple: multiple, options: options %>
<% end %>
<% if multiple && !show_select_all_top && show_select_all_bottom %>
<%= select_all %>
<% end %>
<% end %>
<% end %>
<% end %>