Sha256: e60b4360eba608c541f65d99a45a750e4428710b90368dd6dd82c8740cd6210c

Contents?: true

Size: 762 Bytes

Versions: 6

Compression:

Stored size: 762 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
  name = local_assigns.has_key?(:name) && name ? name.to_s.humanize : attribute
  required = local_assigns.has_key?(:required) ? required : false

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

<%= form.label name, options %>

Version data entries

6 entries across 6 versions & 1 rubygems

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