Sha256: ee646603f79f84ab6224965d131428b37d98b1e2e4020233062420af02282384

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

- namespace = { }
- tags = @page.tags(true).select{ |t| t.is_cms_block? }.uniq_by{|t| t.identifier} 
- tags.each do |tag|
  - namespace[tag.namespace || 'default'] ||= []
  - namespace[tag.namespace || 'default'] << tag

#form-blocks
  - if tags.empty?
    .no-tags
      = link_to @page.layout.label, edit_cms_admin_site_layout_path(@site, @page.layout)
      = t('.no_tags').html_safe
  
  - else
    = fields_for :blocks, nil, :builder => ComfortableMexicanSofa::FormBuilder do |cms_blocks|
      
      .tabbable
        - if namespace.size > 1
          %ul.nav.nav-tabs
            - namespace.each_with_index do |(name, tags), index|
              %li{:class => index == 0 ? 'active' : nil}
                = link_to name.humanize, "#ns-#{name}", :data => {:toggle => 'tab'}
        .tab-content
          - block_index = 0
          - namespace.each_with_index do |(name, tags), index|
            .tab-pane{:id => "ns-#{name}", :class => index == 0 ? 'active' : nil}
              - tags.each do |tag|
                = cms_blocks.send(tag.class.to_s.demodulize.underscore, tag, block_index) rescue nil
                - block_index += 1

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.8.5 app/views/cms_admin/pages/_form_blocks.html.haml
comfortable_mexican_sofa-1.8.4 app/views/cms_admin/pages/_form_blocks.html.haml
comfortable_mexican_sofa-1.8.3 app/views/cms_admin/pages/_form_blocks.html.haml
comfortable_mexican_sofa-1.8.2 app/views/cms_admin/pages/_form_blocks.html.haml
comfortable_mexican_sofa-1.8.1 app/views/cms_admin/pages/_form_blocks.html.haml
comfortable_mexican_sofa-1.8.0 app/views/cms_admin/pages/_form_blocks.html.haml
comfortable_mexican_sofa-1.7.3 app/views/cms_admin/pages/_form_blocks.html.haml
comfortable_mexican_sofa-1.7.1 app/views/cms_admin/pages/_form_blocks.html.haml
comfortable_mexican_sofa-1.7.0 app/views/cms_admin/pages/_form_blocks.html.haml