Sha256: f43e24150db46a9f1841ab7889248e5cf888899e72b4c8bdadfb9533ac463e6e

Contents?: true

Size: 1.64 KB

Versions: 2

Compression:

Stored size: 1.64 KB

Contents

<% yield %>

<%
form ||= current_fields_form
html_options ||= {}
html_options[:id] ||= form.field_id(method)
multiple ||= false
use_columns ||= false
other_options ||= {}
options ||= options_for(form, method)
labels = labels_for(form, method)
%>

<%= render 'shared/fields/field', form: form, method: method, options: html_options, other_options: other_options do %>
  <% content_for :field do %>
    <div class="pt-1.5 pb-1 sm:col-span-2">
      <%= tag.div class: ["max-w-lg": !use_columns, "max-w-3xl": use_columns, "columns-[var(--column-width,_15ch)_3]": use_columns] do %>

        <% options.each do |value, label| %>

          <label class="relative flex items-start mb-3">
            <div class="flex items-center h-5">

              <% if multiple %>
                <% checked_value = form.object.send(method).nil? ? nil : form.object.send(method).map(&:to_s).include?(value.to_s) %>
                <%= form.check_box method, {multiple: multiple, checked: checked_value, class: "focus:ring-blue h-4 w-4 text-blue border-gray-300 rounded"}, value, "" %>
              <% else %>
                <%= form.radio_button method, value, {class: "focus:ring-blue h-4 w-4 text-blue border-gray-300"} %>
              <% end %>

            </div>
            <div class="ml-2.5 text-sm">
              <div class="select-none"><%= label %></div>
              <% if labels.options_help&.dig(value)&.present? %>
                <p class="mt-0.5 text-xs text-gray-500">
                  <%= labels.options_help.dig(value) %>
                </p>
              <% end %>
            </div>
          </label>

        <% end %>

      <% end %>
    </div>
  <% end %>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bullet_train-themes-tailwind_css-1.0.16 app/views/themes/tailwind_css/fields/_options.html.erb
bullet_train-themes-tailwind_css-1.0.15 app/views/themes/tailwind_css/fields/_options.html.erb