Sha256: 5f385ee55177e3058aac91433463fb82de852cf72c17bb10497aa71dc8de2818

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

- begin
  - nodes = record.fragment_nodes

  // Grouping nodes by their namespace
  - namespace = nodes.each_with_object({}) do |n, h|
    - h[n.namespace] ||= []
    - h[n.namespace] << n

  #form-fragments
    - if nodes.empty?
      .alert.alert-warning
        - if record.layout
          = link_to record.layout.label, edit_comfy_admin_cms_site_layout_path(@site, record.layout)
        = t(".no_tags").html_safe

    - else
      = fields_for :fragments, nil, builder: ComfortableMexicanSofa::FormBuilder, layout: :horizontal do |fragments|

        .tabbable
          - if namespace.size > 1
            .row
              .col-sm-2
              .col-sm-10
                %ul.nav.nav-tabs
                  - namespace.each_with_index do |(name, tags), index|
                    %li.nav-item
                      - active = index == 0 ? "active" : nil
                      - label = t("comfy.cms.content.namespace.#{name}", default: name.humanize)
                      = link_to label, "#ns-#{name}", class: "nav-link #{active}", data: {toggle: "tab"}

          .tab-content
            - frag_index = 0
            - namespace.each_with_index do |(name, tags), index|
              .tab-pane{id: "ns-#{name}", class: index == 0 ? "active" : nil}
                - tags.each do |tag|
                  = fragments.field(record, tag, frag_index)
                  - frag_index += 1

- rescue
  - Rails.env.production?? nil : raise

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.8 app/views/comfy/admin/cms/fragments/_form_fragments.html.haml
comfortable_mexican_sofa-2.0.7 app/views/comfy/admin/cms/fragments/_form_fragments.html.haml
comfortable_mexican_sofa-2.0.6 app/views/comfy/admin/cms/fragments/_form_fragments.html.haml
comfortable_mexican_sofa-2.0.5 app/views/comfy/admin/cms/fragments/_form_fragments.html.haml
comfortable_mexican_sofa-2.0.4 app/views/comfy/admin/cms/fragments/_form_fragments.html.haml
comfortable_mexican_sofa-2.0.3 app/views/comfy/admin/cms/fragments/_form_fragments.html.haml
comfortable_mexican_sofa-2.0.2 app/views/comfy/admin/cms/pages/_form_fragments.html.haml
comfortable_mexican_sofa-2.0.1 app/views/comfy/admin/cms/pages/_form_fragments.html.haml