Sha256: f93676b3822e2db4776cab25b285c07702c70bc91592f69a83a82028db6f3f32

Contents?: true

Size: 1.86 KB

Versions: 6

Compression:

Stored size: 1.86 KB

Contents

- if model_object.errors.any?
  #error_explanation
    %ul
      - model_object.errors.full_messages.each do |msg|
        %li= msg
- model_presenter.form_for(action).lines.each do |line|
  .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}')"
          %ul.nested-form-list{:class => field.name}
            - 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?
                = inner_form.input :id, :as => :hidden
                = inner_form.input :_destroy, :as => :hidden, :input_html => {:class => "destroy"} if field.nested_form_allow_destroy?
                - nested_presenter = model_presenter.presenter_to_field(field, inner_form.object)
                = render '/carnival/shared/form/inner_form', button: t('update'), model_object: inner_form.object, model_presenter: nested_presenter, :nested_in => model_object, :f => inner_form, :action => action
      - else
        - if model_presenter.must_render_field?(nested_in, field, model_object)
          = render "/carnival/shared/form/field", f: f, field: field, model_presenter: model_presenter

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
carnival-0.0.42 app/views/carnival/shared/form/_inner_form.html.haml
carnival-0.0.41 app/views/carnival/shared/form/_inner_form.html.haml
carnival-0.0.40 app/views/carnival/shared/form/_inner_form.html.haml
carnival-0.0.39 app/views/carnival/shared/form/_inner_form.html.haml
carnival-0.0.38 app/views/carnival/shared/form/_inner_form.html.haml
carnival-0.0.37 app/views/carnival/shared/form/_inner_form.html.haml