Sha256: e91afcc60bfbfb14699eeac81b859466467bf702ffd334768ac0e93ba3ab9365

Contents?: true

Size: 1.46 KB

Versions: 28

Compression:

Stored size: 1.46 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 #{@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

28 entries across 28 versions & 1 rubygems

Version Path
avo-2.16.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.15.3 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.15.3.pre.1.data.attrs.to.sidebar.items app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.15.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.15.2.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.15.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.15.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.3.pre.7.polytranslations1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.3.pre.6.nosprockets app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.3.pre.5.nosprockets app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.3.pre.4.tosqlfix app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.3.pre.3.jsbundling app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.3.pre.2.tailwindcss app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.3.pre.1.branding app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.2.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.1.pre.1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.14.0 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-2.13.6.pre.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb