Sha256: f7496c32c4b63e17417e5cb3dea35c1e9bf18637f783aed4a85af1932965085e

Contents?: true

Size: 889 Bytes

Versions: 7

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

7 entries across 7 versions & 1 rubygems

Version Path
headmin-0.4.2 app/views/headmin/forms/fields/_base.html.erb
headmin-0.4.1 app/views/headmin/forms/fields/_base.html.erb
headmin-0.4.0 app/views/headmin/forms/fields/_base.html.erb
headmin-0.3.4 app/views/headmin/forms/fields/_base.html.erb
headmin-0.3.3 app/views/headmin/forms/fields/_base.html.erb
headmin-0.3.2 app/views/headmin/forms/fields/_base.html.erb
headmin-0.3.1 app/views/headmin/forms/fields/_base.html.erb