Sha256: 86639577cf0187cb0882f6b500c8f73ba676e9836c502f0c3362f5a43d98a250

Contents?: true

Size: 1.2 KB

Versions: 147

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

Version data entries

147 entries across 147 versions & 1 rubygems

Version Path
avo-1.7.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.7.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.6.4.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.6.3.pre.3 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.6.3.pre.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.6.3.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.6.2.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.6.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.6.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.5.5 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.5.4 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.5.3 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.5.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.5.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.5.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.4.5.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.4.4.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.4.4 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.4.3 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-1.4.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb