2010-06-08 00:45:49 +00:00
|
|
|
- collection_name = "#{collection_name.singularize}_custom_fields"
|
|
|
|
- custom_fields = f.object.send(collection_name.to_sym)
|
|
|
|
- ordered_custom_fields = f.object.send(:"ordered_#{collection_name}")
|
|
|
|
|
2010-06-10 14:50:50 +00:00
|
|
|
= f.foldable_inputs :name => :custom_fields, :class => 'editable-list fields' do
|
2010-06-08 00:45:49 +00:00
|
|
|
- ordered_custom_fields.each do |field|
|
|
|
|
= f.fields_for collection_name.to_sym, field, :child_index => field._index do |g|
|
2010-06-14 13:04:01 +00:00
|
|
|
%li{ :class => "item added #{'new' if f.object.new_record?} #{'error' unless field.errors.empty?}"}
|
2010-06-08 00:45:49 +00:00
|
|
|
%span.handle
|
|
|
|
= image_tag 'admin/form/icons/drag.png'
|
|
|
|
|
|
|
|
= g.hidden_field :position, :class => 'position'
|
|
|
|
|
|
|
|
= g.hidden_field :_alias, :class => 'alias'
|
2010-06-10 13:30:22 +00:00
|
|
|
|
|
|
|
= g.hidden_field :hint, :class => 'hint'
|
2010-06-08 00:45:49 +00:00
|
|
|
|
2010-06-14 13:04:01 +00:00
|
|
|
= g.text_field :label, :class => 'label'
|
2010-06-08 00:45:49 +00:00
|
|
|
|
|
|
|
—
|
|
|
|
|
|
|
|
%em= t("admin.custom_fields.kind.#{field.kind.downcase}")
|
|
|
|
|
|
|
|
= g.select :kind, options_for_field_kind
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%span.actions
|
|
|
|
= link_to image_tag('admin/form/pen.png'), '#edit-custom-field', :class => 'edit first'
|
|
|
|
= link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove', :confirm => t('admin.messages.confirm')
|
|
|
|
|
2010-06-10 13:30:22 +00:00
|
|
|
= f.fields_for collection_name.to_sym, custom_fields.build(:label => 'field name', :_alias => ''), :child_index => '-1' do |g|
|
2010-06-08 00:45:49 +00:00
|
|
|
%li{ :class => 'item template' }
|
|
|
|
%span.handle
|
|
|
|
= image_tag 'admin/form/icons/drag.png'
|
|
|
|
|
|
|
|
= g.hidden_field :position, :class => 'position'
|
|
|
|
|
|
|
|
= g.hidden_field :_alias, :class => 'alias'
|
2010-06-10 13:30:22 +00:00
|
|
|
|
|
|
|
= g.hidden_field :hint, :class => 'hint'
|
2010-06-08 00:45:49 +00:00
|
|
|
|
|
|
|
= g.text_field :label, :class => 'string label void'
|
|
|
|
|
|
|
|
—
|
|
|
|
|
|
|
|
%em
|
|
|
|
|
|
|
|
= g.select :kind, options_for_field_kind
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%span.actions
|
|
|
|
= link_to image_tag('admin/form/pen.png'), '#edit-custom-field', :class => 'edit first'
|
|
|
|
= link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove', :confirm => t('admin.messages.confirm')
|
|
|
|
%button{ :class => 'button light add', :type => 'button' }
|
|
|
|
%span= t('admin.buttons.new_item')
|