engine/app/views/admin/custom_fields/_index.html.haml
2010-07-22 01:56:42 +02:00

62 lines
2.2 KiB
Plaintext

- collection_name = "#{collection_name.singularize}_custom_fields"
- custom_fields = form.object.send(collection_name.to_sym)
- ordered_custom_fields = form.object.send(:"ordered_#{collection_name}")
= form.foldable_inputs :name => :custom_fields, :class => 'editable-list fields' do
- ordered_custom_fields.each do |field|
= form.fields_for collection_name.to_sym, field, :child_index => field._index do |g|
%li{ :class => "item added #{'new' if form.object.new_record?} #{'error' unless field.errors.empty?}"}
%span.handle
= image_tag 'admin/form/icons/drag.png'
= g.hidden_field :position, :class => 'position'
= g.hidden_field :_alias, :class => 'alias'
= g.hidden_field :hint, :class => 'hint'
= g.hidden_field :text_formatting, :class => 'text-formatting'
= g.text_field :label, :class => 'label'
—
%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')
= form.fields_for collection_name.to_sym, custom_fields.build(:label => 'field name', :_alias => ''), :child_index => '-1' do |g|
%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'
= g.hidden_field :hint, :class => 'hint'
= g.hidden_field :text_formatting, :class => 'text-formatting'
= 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')