Sha256: 2b72ce93ed7d0487dff617e38be84ee7e85ad87a494c8f01247efd65466f5dc5

Contents?: true

Size: 907 Bytes

Versions: 10

Compression:

Stored size: 907 Bytes

Contents

<%
  # name: headmin/forms/fields/base
  #
  # ==== Options
  # * <tt>form<tt> - Form object
  # * <tt>name<tt> - Name for the field
  # * <tt>field_type<tt> - Type of the field. Options: [:text, :image, :file, :list, :group]
  #
  # ==== Examples
  #   Basic version
  #   <%= render 'headmin/forms/fields/base', form: form, field_type: :text, name: name do |field, label| %#>
  #     <%= render "headmin/forms/text", form: field, attribute: :value, label: label %#>
  #   <% end %#>

  field = form.object.fields.detect { |field| field.name.to_s == name.to_s }
  field = field ? field : form.object.fields.new(field_type: field_type, name: name)
  label = t("attributes.#{name.to_s.parameterize}", default: field.name.to_s)
%>

<%= form.fields_for :fields, field do |ff| %>
  <%= ff.hidden_field :id %>
  <%= ff.hidden_field :name %>
  <%= ff.hidden_field :field_type %>
  <%= yield ff, label %>
<% end %>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
headmin-0.2.9 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.8 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.7 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.6 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.5 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.4 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.3 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.2 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.1 app/views/headmin/forms/fields/_base.html.erb
headmin-0.2.0 app/views/headmin/forms/fields/_base.html.erb