app/views/carnival/shared/form/_inner_form.html.haml in carnival-0.0.42 vs app/views/carnival/shared/form/_inner_form.html.haml in carnival-0.0.43

- old
+ new

@@ -7,16 +7,31 @@ .row - line.each do |field| - nested_in = nil unless nested_in - if field.nested_form? .nested-form{:class => field.name} + %h3.nested-form-title = t("activerecord.attributes.#{@model_presenter.full_model_name}.#{field.name}") .nested-form-actions - = link_to_function t("close"), "toggleNestedForm(this);" - = " | " - = link_to_function t("add"), "createNewForm('.nested-form-list.#{field.name}', '#{field.name}')" + = link_to_function t("nested_form.close"), "toggleNestedForm(this);" + + - if field.nested_form_modes?(:new) + = " | " + = link_to_function t("nested_form.new"), "createNewForm('.nested-form-list.#{field.name}', '#{field.name}')" + + - if field.nested_form_modes?(:associate) + = " | " + = link_to_function t("nested_form.existing_option"), "renderSelectOptions()" + + .existing-options + %h4.existing-options-title + = t("nested_form.existing_option_title") + = f.association field.name.to_sym, as: :check_boxes,label: false + %ul.nested-form-list{:class => field.name} + %h4.nested-form-subtitle + = t("nested_form.new_subtitle") - model_object.send(field.name).build = f.simple_fields_for field.name.to_sym do |inner_form| %li.nested-form-list-item{:class => "#{inner_form.object.id.nil? and inner_form.object.errors.size == 0 ? 'form-new-association' : 'form-existent-association'}" } .nested-form-list-item-actions = link_to_function t("remove"), "removeNestedFormElement(this);" if field.nested_form_allow_destroy?