Sha256: d0ffc596e5611c904419740e9c529db8e72e3cdd8c7d3adda0c68ef28e705014

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

<%#
    name: headmin/fields/date
    accepts block: no
    parameters:
      form: Form object
      attribute: (string) Name of the attribute of the form model
      label: (bool) Label will not be displayed if value is false
      min: (string) Earliest available timestamp in options
      max: (string) Last available timestamp in options
%>

<% label = local_assigns.has_key?(:label) ? label : true %>
<% disabled = local_assigns.has_key?(:disabled) ? disabled : false %>
<% required = local_assigns.has_key?(:required) ? required : false %>
<% readonly = local_assigns.has_key?(:readonly) ? readonly : false %>
<% class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false %>
<% datepicker = local_assigns.has_key?(:datepicker) ? local_assigns[:datepicker] : false %>
<% datepicker_class = datepicker ? 'flatpickr' : nil %>
<% validation_class = form_field_validation_class(form, attribute) %>
<div class="<%= ('mb-3' if label) %>">
  <%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label %>
  <div class="input-group">
    <span class="input-group-text"><%= bootstrap_icon('calendar') %></span>
    <%= form.date_field(
          attribute,
          placeholder: 'dd/mm/yyyy',
          class: "form-control #{validation_class} #{datepicker_class} #{class_names}",
          disabled: disabled,
          required: required,
          readonly: readonly,
          'aria-describedby': form_field_validation_id(form, attribute)
        )
    %>
  </div>
  <%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>
</div>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
headmin-0.1.2 app/views/headmin/forms/fields/_date.html.erb
headmin-0.1.1 app/views/headmin/forms/fields/_date.html.erb