Sha256: 7d89cda4ded3fa16106247f9ca45a4fa2cf064c92fd5c8ad986130d9ec951ca8

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

<%
  # name: headmin/forms/fields/group
  #
  # ==== Options
  # * +form+ - Form object
  # * +name+ - Name for the field
  # * +label+ - Text to show as label. Label will be hidden if value is false
  #
  # ==== Examples
  #   Basic version
  #   <%= render "headmin/forms/fields/group", form: form, name: :button do |group| %#>
  #     <div class="row">
  #       <div class="col-md-6">
  #         <%= render "headmin/forms/fields/text", form: group, name: :name do |field, attribute, label| %#>
  #           <%= render "headmin/forms/text", form: field, attribute: attribute, label: label %#>
  #         <% end %#>
  #       </div>
  #       <div class="col-md-6">
  #         <%= render "headmin/forms/fields/text", form: group, name: :url do |field, attribute, label| %#>
  #           <%= render "headmin/forms/text", form: field, attribute: attribute, label: label %#>
  #         <% end %#>
  #       </div>
  #     </div>
  #   <% end %#>

  label = local_assigns.has_key?(:label) ? label : nil
  wrapper = local_assigns.has_key?(:wrapper) ? local_assigns[:wrapper] : true
  show_label = label != false
%>

<%= render "headmin/forms/fields/base", form: form, name: name, field_type: :group do |group, field_label| %>
  <% if show_label %>
    <%= render "headmin/forms/label", form: form, attribute: :value, text: label || field_label %>
  <% end %>

  <% if wrapper %>
  <ul class="list-group mb-3">
    <li class="list-group-item">
      <%= yield group %>
    </li>
  </ul>
  <% else %>
    <%= yield group %>
  <% end %>
<% end %>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
headmin-0.5.9 app/views/headmin/forms/fields/_group.html.erb
headmin-0.5.8 app/views/headmin/forms/fields/_group.html.erb
headmin-0.5.7 app/views/headmin/forms/fields/_group.html.erb
headmin-0.5.6 app/views/headmin/forms/fields/_group.html.erb
headmin-0.5.5 app/views/headmin/forms/fields/_group.html.erb
headmin-0.5.4 app/views/headmin/forms/fields/_group.html.erb
headmin-0.5.3 app/views/headmin/forms/fields/_group.html.erb
headmin-0.5.1 app/views/headmin/forms/fields/_group.html.erb
headmin-0.5.0 app/views/headmin/forms/fields/_group.html.erb