<% # headmin/forms/checkbox # # ==== Options # * form - Form object # * attribute - Name of the attribute of the form model # * label - Text to show as label. Label will be hidden if value is false # # ==== Examples # Basic version # <%= render 'headmin/forms/image', form: form, attribute: :image %#> class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false data = local_assigns.has_key?(:data) ? data : nil disabled = local_assigns.has_key?(:disabled) ? disabled : false label = local_assigns.has_key?(:label) ? label : nil readonly = local_assigns.has_key?(:readonly) ? readonly : false required = local_assigns.has_key?(:required) ? required : false options = { 'aria-describedby': form_field_validation_id(form, attribute), class: "form-checkbox-input #{form_field_validation_class(form, attribute)} #{class_names}", data: data, disabled: disabled, placeholder: attribute, readonly: readonly, required: required, } show_label = label != false %>
<%= form.check_box(attribute, options) %> <% if show_label %> <%= render 'headmin/forms/label', form: form, attribute: attribute, name: label, required: required %> <% end %> <%= render 'headmin/forms/validation', form: form, attribute: attribute %>