Module: Cms::SectionNodesHelper

Defined in:
app/helpers/cms/section_nodes_helper.rb

Instance Method Summary collapse

Instance Method Details

#access_status(section_node, public_sections) ⇒ Object



4
5
6
7
8
9
10
# File 'app/helpers/cms/section_nodes_helper.rb', line 4

def access_status(section_node, public_sections)
  access_icon = :unlocked
  unless public_sections.include?(section_node)
    access_icon = :locked
  end
  access_icon
end

#in_first_level?(node) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/helpers/cms/section_nodes_helper.rb', line 40

def in_first_level?(node)
  node.section_node.depth == 1
end

#section_icons(section_node, children = []) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/cms/section_nodes_helper.rb', line 12

def section_icons(section_node, children=[])
  folder_style = ""
  expander_image = "expand.png"
  if top_level_section?(section_node)
    folder_style = " large"
    expander_image = "gray_expand.png"
  end
  if children.empty?
    image_tag("cms/sitemap/no_contents.png", :class => "no_folder_toggle#{folder_style}")
  else
    image_tag("cms/sitemap/#{expander_image}", :class => "folder_toggle#{folder_style}")
  end
end

#sitemap_ul_tag(node) ⇒ Object

Renders the ul for a given node (Page/Section/Link/etc) Default look:

- First level pages/sections use 'big' icons
- All non-first level items should be hidden.


30
31
32
33
34
35
36
37
38
# File 'app/helpers/cms/section_nodes_helper.rb', line 30

def sitemap_ul_tag(node)
  opts = {
    :id => "section_node_#{node.section_node.id}",
    :class => "section_node"
  }
  opts[:class] += " rootlet" if in_first_level?(node)
  opts[:style] = "display: none" unless in_first_level?(node)
  tag("ul", opts, true)
end