Sha256: 8d4ce69430b48f81975ff1f6d90a31019372c22a0d9b98926701505dabb119f2

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 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 ComfortableMexicanSofa::Content::Renderer::SyntaxError, ComfortableMexicanSofa::Content::Tag::Error => e
  .alert.alert-danger
    = e

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.9 app/views/comfy/admin/cms/fragments/_form_fragments.html.haml