<%# name: headmin/fields/text accepts block: no parameters: form: Form object attribute: (string) Name of the attribute of the form model label: (bool | string) Label will not be displayed if value is false or accepts a string 'float' to get a "floating label" %> <% label = local_assigns.has_key?(:label) ? label : true %> <% float_label = label == :float %> <% 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 %> <% has_list = local_assigns.has_key?(:collection) %>
<%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && !float_label %> <%= form.email_field( attribute, class: "form-control #{form_field_validation_class(form, attribute)} #{class_names}", list: has_list ? attribute : nil, disabled: disabled, placeholder: attribute, required: required, readonly: readonly, 'aria-describedby': form_field_validation_id(form, attribute) ) %> <%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && float_label %> <% if has_list %> <% collection.each do |key, value| %> <% end %> <% end %> <%= render 'headmin/forms/fields/validation', form: form, attribute: attribute %>