Sha256: 4c21cc95777b4713f32900883a8995cfb90e568c92865d9d25dbe6fcda500a68

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

<%#
    name: headmin/fields/textarea
    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 %>
<% required = local_assigns.has_key?(:required) ? required : false %>
<% class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false %>
<% data = local_assigns.has_key?(:data) ? data : nil %>
<div class="<%= 'form-floating' if float_label %> <%= ('mb-3 text-start' if label) %>">
  <%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && !float_label %>
  <%= form.text_area(
        attribute,
        class: "form-control #{class_names} #{form_field_validation_class(form, attribute)}",
        required: required,
        placeholder: attribute,
        'aria-describedby': form_field_validation_id(form, attribute),
        data: data
      )
  %>
  <%= render 'headmin/forms/fields/label', form: form, attribute: attribute, required: required if label && float_label %>
  <%= 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/_textarea.html.erb
headmin-0.1.1 app/views/headmin/forms/fields/_textarea.html.erb