Sha256: 2bb1f416d64ba9b11ff5eae0edf1ca64d4be74d12bcf37bdd2fb9a3b1156f731

Contents?: true

Size: 889 Bytes

Versions: 10

Compression:

Stored size: 889 Bytes

Contents

<%
  # name: headmin/forms/fields/base
  #
  # ==== Options
  # * +form+ - Form object
  # * +name+ - Name for the field
  # * +field_type+ - 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.6.0 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.9 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.8 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.7 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.6 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.5 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.4 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.3 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.1 app/views/headmin/forms/fields/_base.html.erb
headmin-0.5.0 app/views/headmin/forms/fields/_base.html.erb