Sha256: 895f96a7feb6528b710e8b0f23b828ebe60becd4325585d60c2b94e115c32543

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

<%
  # name: headmin/forms/label
  #
  # ==== Options
  # * <tt>form<tt> - Form object
  # * <tt>attribute<tt> - Name of the attribute of the form model
  # * <tt>name<tt> - Custom label to be used instead of the attribute
  # * <tt>required<tt> - Set to true if you want to highlight the requirement
  #
  # ==== Examples
  #   Basic version
  #   <%= render 'headmin/forms/label', form: form, attribute: :image %#>

  class_names = local_assigns.has_key?(:class) ? local_assigns[:class] : false
  custom_name = local_assigns.has_key?(:name) && name ? name.to_s.humanize : nil
  required = local_assigns.has_key?(:required) ? required : false

  options = {
    class: "form-label #{class_names}",
    required: required,
  }
%>

<%= form.label attribute, custom_name, options %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
headmin-0.2.7 app/views/headmin/forms/_label.html.erb
headmin-0.2.6 app/views/headmin/forms/_label.html.erb