Sha256: e8c653f82d09cd4682ef182541119c29385801eef5ca4cc2a70bc30aa0da1793

Contents?: true

Size: 1.67 KB

Versions: 12

Compression:

Stored size: 1.67 KB

Contents

module KonoUtils
  module Object
    module Cell
      module Forms # namespace
        module Fields
          ##
          # Rappresenta la classe che renderizza il contenitore della singola nested form
          #
          # ** Options:
          # - as_display_list -> Boolean che mi definisce se renderizzare come solo display la lista dei componenti
          #
          ##
          class NestedWrappers::FormsContainer < Base

            delegates :parent_cell, :has_multiple_elements?

            def parent_cell
              context[:parent_cell]
            end

            # causa di una stranezza di simple form che non ritiene safe il contenuto passato
            def inner_form_block
              form.simple_fields_for(attribute_name, include_id: false) do |inside_form|
                capture do
                  yield(inside_form)
                end.html_safe
              end
            end

            ##
            # Restituisce il nome della cella da renderizzare, รจ possibile che sia una form o la show
            def render_cell_container
              "cell/forms/fields/nested_wrappers/form"
            end

            ##
            # Per i nested abbiamo un elenco di campi da visualizzare,
            # questo elenco ci viene fornito tramite il modello EditableField, il quale elabora rispetto ai nested delle policy
            def inner_fields
              model.inner_fields
            end

            def form_layout
              layout = context[:nested_layout].blank? ? "layout" : context[:nested_layout]
              layout_ns("cell/forms/fields/nested_wrappers/forms/#{layout}")
            end

          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kono_utils_bootstrap_view4-0.3.2 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.3.1 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.3 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.2.3 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.2.2 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.2.1 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.2 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.1.2 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.1.1 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.1.0 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.1.0.pre.rc.7 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb
kono_utils_bootstrap_view4-0.1.0.pre.rc.4 app/concepts/kono_utils/object/cell/forms/fields/nested_wrappers/forms_container.rb