engine/app/views/admin/custom_fields/types/_has_many.html.haml

33 lines
1.2 KiB
Plaintext
Raw Normal View History

= form.custom_input field._alias.to_sym, :label => field.label, :hint => field.hint, :css => 'has-many', :required => required 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
- if field.reverse_lookup?
= link_to image_tag('admin/form/pen.png'), '#', :class => 'edit first'
= 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' }
!= has_many_data_to_js(field, form.object)