Sha256: a243c74a650deef9637fcde7f44797c620faf3c8c5e216993b9ec91c5e62fcb1
Contents?: true
Size: 889 Bytes
Versions: 3
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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
headmin-0.6.3 | app/views/headmin/forms/fields/_base.html.erb |
headmin-0.6.2 | app/views/headmin/forms/fields/_base.html.erb |
headmin-0.6.1 | app/views/headmin/forms/fields/_base.html.erb |