Sha256: b371af661bee591b7c144d57a9a388105787069b93ac70619d889227fa655c17

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

<%
  # name: headmin/forms/fields/list
  #
  # ==== 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/list", form: form, name: :websites do |list| %#>
  #     <%= render "headmin/forms/fields/text", form: list, name: :url do |field, attribute, label| %#>
  #       <%= render "headmin/forms/text", form: field, attribute: attribute, label: label %#>
  #     <% end %#>
  #   <% end %#>

  label = local_assigns.has_key?(:label) ? label : nil
  show_label = label != false
%>

<%= render "headmin/forms/fields/base", form: form, name: name, field_type: :list do |list, field_label| %>
  <div class="mb-3">
    <%= render "headmin/forms/repeater", form: list, attribute: :fields, label: show_label ? label || field_label : false, flush: false do |field| %>
      <%= field.hidden_field :field_type, value: :group %>
      <%= yield field %>
    <% end %>
  </div>
<% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
headmin-0.5.9 app/views/headmin/forms/fields/_list.html.erb
headmin-0.5.8 app/views/headmin/forms/fields/_list.html.erb
headmin-0.5.7 app/views/headmin/forms/fields/_list.html.erb
headmin-0.5.6 app/views/headmin/forms/fields/_list.html.erb
headmin-0.5.5 app/views/headmin/forms/fields/_list.html.erb
headmin-0.5.4 app/views/headmin/forms/fields/_list.html.erb