2012-02-01 01:01:42 +00:00
|
|
|
- if !f.object.new_record? && field.ui_enabled?
|
2011-05-19 16:00:45 +00:00
|
|
|
|
2012-02-02 15:53:26 +00:00
|
|
|
- target_content_type = Locomotive::ContentType.class_name_to_content_type(field.class_name, current_site)
|
|
|
|
- new_target_content_entry = target_content_type.entries.build(field.inverse_of => f.object)
|
|
|
|
|
2012-02-01 01:01:42 +00:00
|
|
|
= 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' }
|
2011-05-19 16:00:45 +00:00
|
|
|
|
2012-02-01 01:01:42 +00:00
|
|
|
- content_for :head do
|
2011-05-19 16:00:45 +00:00
|
|
|
|
2012-02-01 01:01:42 +00:00
|
|
|
%script{ :type => 'text/html', :id => "#{name}_list" }
|
2011-05-19 16:00:45 +00:00
|
|
|
|
2012-02-01 01:01:42 +00:00
|
|
|
%p.empty{ :style => 'display: none' }!= t('.empty')
|
2011-05-19 16:00:45 +00:00
|
|
|
|
2012-02-01 01:01:42 +00:00
|
|
|
%ul
|
2011-05-19 16:00:45 +00:00
|
|
|
|
2012-02-01 01:01:42 +00:00
|
|
|
%hr
|
2011-05-19 16:00:45 +00:00
|
|
|
|
2012-02-02 15:53:26 +00:00
|
|
|
%p.actions
|
|
|
|
= link_to t('.new_entry'), '#', :class => 'add'
|
2012-02-01 01:01:42 +00:00
|
|
|
|
|
|
|
%script{ :type => 'text/html', :id => "#{name}_entry" }
|
|
|
|
%li
|
|
|
|
.handle.col
|
|
|
|
= image_tag 'locomotive/form/icons/drag.png'
|
|
|
|
|
|
|
|
.label.col
|
|
|
|
{{label}}
|
2011-05-19 16:00:45 +00:00
|
|
|
|
|
|
|
%span.actions
|
2012-02-02 15:53:26 +00:00
|
|
|
= link_to 'e', '#', :class => 'edit'
|
2012-02-01 01:01:42 +00:00
|
|
|
= link_to 'x', '#', :class => 'remove', :confirm => t('locomotive.messages.confirm')
|
|
|
|
|
|
|
|
|
2012-02-02 15:53:26 +00:00
|
|
|
- content_for :backbone_view_data do
|
|
|
|
:plain
|
|
|
|
, #{name}_new_entry: #{new_target_content_entry.to_json}
|
|
|
|
|
|
|
|
- content_for :foot do
|
|
|
|
|
|
|
|
%div{ :id => "#{name}-template-entry", :style => 'display: none' }
|
|
|
|
|
|
|
|
%h2
|
|
|
|
%span.new-section= t('locomotive.content_entries.new.title', :type => name.capitalize).html_safe
|
|
|
|
%span.edit-section= t('locomotive.content_entries.edit.title', :type => name.capitalize).html_safe
|
|
|
|
|
|
|
|
= semantic_form_for new_target_content_entry, :as => :content_entry, :url => content_entries_url(target_content_type.slug), :html => { :multipart => true } do |form|
|
|
|
|
|
|
|
|
= form.inputs :name => :attributes do
|
|
|
|
- target_content_type.ordered_entries_custom_fields.each_with_index do |_field, index|
|
|
|
|
|
2012-03-01 10:07:22 +00:00
|
|
|
- next if _field.name == field.inverse_of || %w(has_many many_to_many).include?(_field.type)
|
2012-02-02 15:53:26 +00:00
|
|
|
|
|
|
|
= render "locomotive/custom_fields/types/#{_field.type}",
|
|
|
|
:f => form,
|
|
|
|
:name => _field.name.to_sym,
|
|
|
|
:field => _field,
|
|
|
|
:highlighted => _field._id == target_content_type.label_field_id
|
|
|
|
|
|
|
|
|
|
|
|
.dialog-actions
|
|
|
|
= link_to t('locomotive.buttons.close'), '#', :id => 'close-link'
|
|
|
|
|
|
|
|
.button-wrapper
|
|
|
|
%span.new-section= submit_tag t('locomotive.shared.form_actions.create')
|
|
|
|
%span.edit-section= submit_tag t('locomotive.shared.form_actions.update')
|
|
|
|
|