Sha256: de3d098034f9be6322daa1e444e7b6208498bb0cea7b1ec728c846d514fcb0e1

Contents?: true

Size: 1.37 KB

Versions: 15

Compression:

Stored size: 1.37 KB

Contents

<%= field_wrapper **field_wrapper_args do %>
  <div class="flex items-center">
    <div class="space-y-2">
      <% model_param_key = model_name_from_record_or_class(@resource.model).param_key %>
      <%= check_box_tag "#{model_name_from_record_or_class(@resource.model).param_key}[#{@field.id}][]", '', true, { class: "hidden" } %>
      <% @field.options.each do |id, label| %>
        <%
          checked = false

          # Get the state of the checkboxes from either the form that returns a validation error or from the model itself.
          if params[model_param_key].present? && params[model_param_key][@field.id.to_s].present?
            checked = params[model_param_key][@field.id.to_s].include?(id.to_s)
          else
            if @field.value.present?
              checked = @field.value[id.to_s]
            end
          end
        %>
        <label class="block">
          <%= check_box_tag "#{model_param_key}[#{@field.id}][]", id, checked, {
              class: "w-4 h-4 #{@field.get_html(:classes, view: view, element: :input)}",
              data: @field.get_html(:data, view: view, element: :input),
              disabled: @field.is_readonly?,
              id: "#{model_param_key}_#{@field.id}_#{id}",
              style: @field.get_html(:style, view: view, element: :input)
            } %> <%= label %>
        </label>
      <% end %>
    </div>
  </div>
<% end %>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
avo-2.21.1.pre.pr1476 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.21.1.pre.issue1450 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.21.1.pre.issue1444 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.20.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.19.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.18.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.18.1.pre.1.eagerloaddirs app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.18.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.17.1.pre.5.stackedlayout app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.17.1.pre.4.issue.1342 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.17.1.pre.3 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.17.1.pre.2.customauthorizationclients app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.17.1.pre.1.zeitwerk.eager.load.dir app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.17.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.16.1.pre.1.nativefields app/components/avo/fields/boolean_group_field/edit_component.html.erb