Sha256: f7bf67d30872b1e070ea6b3ee97458f59f132b380224db39edc52e7c383eada3

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 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 ? t("attributes.#{name}") : nil
  required = local_assigns.has_key?(:required) ? required : false
  form_id = form.options.has_key?(:id) ? form.options[:id] : nil

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
headmin-0.2.9 app/views/headmin/forms/_label.html.erb
headmin-0.2.8 app/views/headmin/forms/_label.html.erb