Sha256: 32c40259769a9350bb27f9e49fed2c99cb27ba956a6aba9114f961ed632131a8

Contents?: true

Size: 1.2 KB

Versions: 31

Compression:

Stored size: 1.2 KB

Contents

<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal 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", disabled: @field.readonly, id: "#{model_param_key}_#{@field.id}_#{id}" } %> <%= label %>
        </label>
      <% end %>
    </div>
  </div>
<% end %>

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
avo-2.7.1.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.7.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.6.1.pre.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.6.1.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.6.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.2.pre.7 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.2.pre.6 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.2.pre.5 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.2.pre.4 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.2.pre.3 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.2.pre.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.2.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.5.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.4.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.4.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.3.1.pre.6 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.3.1.pre.5 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.3.1.pre.4 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.3.1.pre.3 app/components/avo/fields/boolean_group_field/edit_component.html.erb