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

70 lines
2.1 KiB
Plaintext
Raw Normal View History

- if !f.object.new_record? && field.ui_enabled?
= f.input name.to_sym,
:label => field.label,
:hint => field.hint,
:as => :'Locomotive::Empty',
:wrapper_html => { :id => "content_entry_#{name}_input", :class => 'empty relationship input' }
- content_for :head do
%script{ :type => 'text/html', :id => "#{name}_list" }
%p.empty{ :style => 'display: none' }!= t('.empty')
%ul
%hr
%p
= link_to t('.new_entry'), '#'
%script{ :type => 'text/html', :id => "#{name}_entry" }
%li
.handle.col
= image_tag 'locomotive/form/icons/drag.png'
.label.col
{{label}}
%span.actions
= link_to 'x', '#', :class => 'remove', :confirm => t('locomotive.messages.confirm')
/ - collection = f.object.send(name.to_sym)
/ = 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('locomotive.buttons.new_item')
/
/ %script{ :type => 'text/javascript', :name => 'data' }
/ != has_many_data_to_js(field, form.object)