2010-06-22 13:04:40 +00:00
|
|
|
- highlighted_field_name = parent.highlighted_field_name rescue ''
|
|
|
|
|
|
|
|
= form.inputs :name => title || :attributes do
|
|
|
|
- form.object.custom_fields.each do |field|
|
2011-03-04 23:29:40 +00:00
|
|
|
- required = highlighted_field_name == field._name || field.required
|
2010-07-21 23:56:42 +00:00
|
|
|
|
2010-06-22 13:04:40 +00:00
|
|
|
- if field.string?
|
|
|
|
= form.input field._alias.to_sym, :label => field.label, :hint => field.hint, :required => required
|
2011-03-17 16:41:25 +00:00
|
|
|
|
2010-06-22 13:04:40 +00:00
|
|
|
- elsif field.text?
|
|
|
|
= form.input field._alias.to_sym, :label => field.label, :hint => field.hint, :as => :text, :required => required, :input_html => { :class => field.text_formatting }
|
2011-03-17 16:41:25 +00:00
|
|
|
|
2010-06-22 13:04:40 +00:00
|
|
|
- elsif field.category?
|
|
|
|
= form.custom_input field._alias.to_sym, :label => field.label, :hint => field.hint, :css => 'toggle' do
|
|
|
|
= form.select field._name.to_sym, field.ordered_category_items.collect { |item| [item.name, item.id] }
|
2011-01-18 17:13:06 +00:00
|
|
|
%button.button.light.edit-categories-link{ :type => 'button', :'data-url' => edit_admin_custom_field_path(parent.class.model_name.underscore, parent.slug, field) }
|
2010-07-21 23:56:42 +00:00
|
|
|
%span!= t('.edit_categories')
|
2011-03-17 16:41:25 +00:00
|
|
|
|
2010-06-22 13:04:40 +00:00
|
|
|
- elsif field.boolean?
|
|
|
|
= form.custom_input field._alias.to_sym, :label => field.label, :hint => field.hint, :css => 'toggle' do
|
2010-06-30 00:03:34 +00:00
|
|
|
= form.check_box field._alias.to_sym
|
2011-03-17 16:41:25 +00:00
|
|
|
|
2010-06-30 00:03:34 +00:00
|
|
|
- elsif field.date?
|
2010-06-30 13:18:17 +00:00
|
|
|
= form.input field._alias.to_sym, :label => field.label, :hint => field.hint, :input_html => { :class => 'date' }
|
2011-03-17 16:41:25 +00:00
|
|
|
|
2010-06-30 13:18:17 +00:00
|
|
|
- elsif field.file?
|
|
|
|
= form.custom_input field._alias.to_sym, :label => field.label, :hint => field.hint, :css => 'file' do
|
|
|
|
= form.file_field field._name.to_sym
|
|
|
|
- if form.object.send(:"#{field._name}?")
|
2010-08-31 21:53:30 +00:00
|
|
|
%p.remove
|
2010-06-30 13:18:17 +00:00
|
|
|
%strong
|
|
|
|
= link_to File.basename(form.object.send(field._name).url), form.object.send(field._name).url
|
|
|
|
%span
|
|
|
|
/
|
2010-07-21 23:56:42 +00:00
|
|
|
!= t('.delete_file')
|
2011-03-17 16:41:25 +00:00
|
|
|
= form.check_box :"remove_#{field._name}"
|
|
|
|
|
2011-05-19 15:44:04 +00:00
|
|
|
- elsif field.has_one?
|
|
|
|
= form.input field._alias.to_sym, :label => field.label, :hint => field.hint, :input_html => { :class => 'has_one' }, :as => :select, :collection => options_for_has_one(field), :selected => form.object.send(field._alias.to_sym).try(:_id)
|
|
|
|
|
|
|
|
- elsif field.has_many?
|
|
|
|
= form.custom_input field._alias.to_sym, :label => field.label, :hint => field.hint, :css => 'has-many' do
|
|
|
|
|
|
|
|
.has-many-selector
|
|
|
|
|
|
|
|
%p{ :style => form.object.send(field._alias.to_sym).empty? ? '' : 'display: none' }
|
|
|
|
= t('.empty')
|
|
|
|
|
|
|
|
%ul
|
|
|
|
|
|
|
|
%script{ :type => 'text/x-mustache-template', :name => 'template', :'data-base-input-name' => "content[#{field._alias.to_sym}]" }
|
|
|
|
%li{ :class => "item {{behaviour_flag}}" }
|
|
|
|
%span.handle
|
|
|
|
= image_tag 'admin/form/icons/drag.png'
|
|
|
|
|
|
|
|
{{^if_template}}
|
|
|
|
%input{ :name => '{{base_name}}[]', :value => '{{{id}}}', :type => 'hidden', :'data-field' => 'id' }
|
|
|
|
{{/if_template}}
|
|
|
|
|
|
|
|
%strong {{label}}
|
|
|
|
|
|
|
|
{{#if_template}}
|
|
|
|
= select_tag 'label', ''
|
|
|
|
{{/if_template}}
|
|
|
|
|
|
|
|
%span.actions
|
|
|
|
= link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove'
|
|
|
|
%button{ :class => 'button light mini add', :type => 'button' }
|
|
|
|
%span!= t('admin.buttons.new_item')
|
|
|
|
|
|
|
|
%script{ :type => 'text/javascript', :name => 'data' }
|
|
|
|
!= collection_to_js(options_for_has_many(field), :taken_ids => form.object.send(field._alias.to_sym).ids)
|
|
|
|
|
2011-03-17 16:41:25 +00:00
|
|
|
= render '/admin/custom_fields/category_tmpl'
|