Sha256: e1fa92703eb703a5cdc30040d2bf4961c3e87232a34e0c63ad95075323bc73db

Contents?: true

Size: 1.38 KB

Versions: 77

Compression:

Stored size: 1.38 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.record).param_key %>
      <%= check_box_tag "#{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 rounded checked:bg-primary-400 focus:checked:!bg-primary-400 #{@field.get_html(:classes, view: view, element: :input)}",
              data: @field.get_html(:data, view: view, element: :input),
              disabled: disabled?,
              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

77 entries across 77 versions & 1 rubygems

Version Path
avo-3.0.1.beta13 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta10 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta11 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.0.pre19 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta8 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta9 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta6 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta7 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta5 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta2 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta4 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta3 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.0.beta1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.1.beta1 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.0.pre17 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.0.pre18 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.0.pre14 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.0.pre16 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.0.0.pre15 app/components/avo/fields/boolean_group_field/edit_component.html.erb
avo-3.2.2 app/components/avo/fields/boolean_group_field/edit_component.html.erb