<% form ||= current_fields_form single_check_box ||= false append_class ||= '' labels = labels_for(form, method) if form options ||= {} options[:multiple] ||= false if defined?(multiple) options[:multiple] = multiple ActiveSupport::Deprecation.new.warn( "The `multiple` attribute will be removed in a later version. " \ "Please pass `options: {multiple: true}` to `render` instead." ) end # Since we don't know at this point which tag we'll be using, we specify # the class only once here for simplicity and apply it to one of the following tags: # 1. form.check_box # 2. check_box # 3. form.radio_button # # the `append_class` local can be used to append any other styles desired for the element. options[:class] ||= "focus:ring-primary-500 h-4 w-4 text-primary-500 border-slate-300 dark:bg-slate-800 dark:border-slate-900 #{"rounded" if options[:multiple] || single_check_box}" options[:class] += " #{append_class}" %> <% if single_check_box %> <% if form %>
<%= form.check_box method, options %> <%= form.label method, class: 'ml-2' %>
<% else %> <% value = options.delete(:value) %> <% checked = options.delete(:checked) %> <%= check_box_tag method, value, checked, options %> <% end %> <% else %> <% option_field_options.each do |value, label| %> <% end %> <% end %>