Sha256: 758f05871b355b2f1e7570db69562690cc00305f092ce6a98cd2ac8d4cae6894

Contents?: true

Size: 1.92 KB

Versions: 6

Compression:

Stored size: 1.92 KB

Contents

<%
  # headmin/forms/date
  #
  # ==== Options
  # * <tt>form<tt> - Form object
  # * <tt>attribute<tt> - Name of the attribute of the form model
  # * <tt>label<tt> - Text to show as label. Label will be hidden if value is false
  # * <tt>float<tt> - Set to true if you want to show floating labels
  # * <tt>append<tt> - Text or icon to be shown on the left hand side of the input, Doesn't work with float
  # * <tt>prepend<tt> - Text or icon to be shown on the right hand side of the input, Doesn't work with float
  #
  # ==== Examples
  #   Basic version
  #   <%= render 'headmin/forms/date', form: form, attribute: :title %#>
  #
  #   With datepicker
  #   <%= render 'headmin/forms/text', form: form, attribute: :title, datepicker: true %#>

  append = local_assigns.has_key?(:append) ? append : nil
  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
  float = local_assigns.has_key?(:float) ? float : false
  label = local_assigns.has_key?(:label) ? label : nil
  prepend = local_assigns.has_key?(:prepend) ? prepend : nil
  readonly = local_assigns.has_key?(:readonly) ? readonly : false
  required = local_assigns.has_key?(:required) ? required : false
  datepicker = local_assigns.has_key?(:datepicker) ? local_assigns[:datepicker] : false

  class_names = "#{class_names} flatpicker" if datepicker

  options = {
    'aria-describedby': form_field_validation_id(form, attribute),
    class: "form-control #{form_field_validation_class(form, attribute)} #{class_names}",
    data: data,
    disabled: disabled,
    placeholder: attribute,
    readonly: readonly,
    required: required,
  }
%>

<%= render 'headmin/forms/base', form: form, attribute: attribute, append: append, prepend: prepend, float: float, label: label, required: required do |form| %>
  <%= form.date_field(attribute, options) %>
<% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
headmin-0.2.5 app/views/headmin/forms/_date.html.erb
headmin-0.2.4 app/views/headmin/forms/_date.html.erb
headmin-0.2.3 app/views/headmin/forms/_date.html.erb
headmin-0.2.2 app/views/headmin/forms/_date.html.erb
headmin-0.2.1 app/views/headmin/forms/_date.html.erb
headmin-0.2.0 app/views/headmin/forms/_date.html.erb