Sha256: 6c287bf1cebe5a12ae61f1f4c3e6e920aa94f007cbfbc232085b6b17b4b40cca

Contents?: true

Size: 1.96 KB

Versions: 4

Compression:

Stored size: 1.96 KB

Contents

<%
  # headmin/forms/email
  #
  # ==== Required parameters
  # * +form+ - Form object
  # * +attribute+ - Name of the attribute of the form model
  #
  # ==== Optional parameters
  # * +aria+ - Provide a hash to define all aria attributes
  # * +autocomplete+ - Value to be autofilled by the browser
  # * +data+ - Provide a hash to define all data attributes
  # * +disabled+ - Sets the placeholder of the field
  # * +id+ - Input identifier
  # * +list+ - Add array of options to show in a data list
  # * +maxlength+ - Maximum amount of characters to be used
  # * +minlength+ - Minimum amount of characters to be used
  # * +multiple+ - Allow multiple comma-separated email addresses to be entered
  # * +pattern+ -a  A regular expression that the input's value must match
  # * +placeholder+ - Sets the placeholder of the field
  # * +readonly+ - Sets the placeholder of the field
  # * +required+ - Set to true to mark as required
  # * +size+ - How much of the input should be shown
  # * +value+ - Overrides the value of the form
  #
  # ==== Extra parameters
  # Listed in 'headmin/forms/base'
  #
  # ==== References
  # https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text
  # https://apidock.com/rails/ActionView/Helpers/FormHelper/text_field
  #
  # ==== Examples
  #   Basic version
  #   <%= render 'headmin/forms/email', form: form, attribute: :email_address %#>

  placeholder = local_assigns[:float] ? local_assigns[:placeholder] || attribute : local_assigns[:placeholder]

  option_keys = %i(aria autocomplete data disabled id maxlenght minlength multiple pattern placeholder readonly required size value)
  options = local_assigns.slice(*option_keys).merge(
    aria: { describedby: form_field_validation_id(form, attribute) },
    class: ['form-control', form_field_validation_class(form, attribute)].join(' '),
    placeholder: placeholder
  )
%>

<%= render 'headmin/forms/base', local_assigns do |form| %>
  <%= form.email_field(attribute, options) %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
headmin-0.3.4 app/views/headmin/forms/_email.html.erb
headmin-0.3.3 app/views/headmin/forms/_email.html.erb
headmin-0.3.2 app/views/headmin/forms/_email.html.erb
headmin-0.3.1 app/views/headmin/forms/_email.html.erb