Parent

Included Modules

Class Index [+]

Quicksearch

Webgen::Tag::BreadcrumbTrail

Generates a breadcrumb trail for the page. This is especially useful when pages are in deep hierarchies of directories.

Public Instance Methods

call(tag, body, context) click to toggle source

Create the breadcrumb trail.

    # File lib/webgen/tag/breadcrumbtrail.rb, line 17
17:     def call(tag, body, context)
18:       out = breadcrumb_trail_list(context.content_node)
19:       (context.dest_node.node_info[:tag_breadcrumb_trail] ||= {})[[@params.to_a.sort, context.content_node.alcn]] = out.map {|n| n.alcn}
20:       out = out.map {|n| context.dest_node.link_to(n, :lang => context.content_node.lang) }.
21:         join(param('tag.breadcrumbtrail.separator'))
22:       log(:debug) { "Breadcrumb trail for <#{context.content_node}>: #{out}" }
23:       out
24:     end

Private Instance Methods

node_changed?(node) click to toggle source

Check if the breadcrumb trails for node have changed.

    # File lib/webgen/tag/breadcrumbtrail.rb, line 51
51:     def node_changed?(node)
52:       return if !node.node_info[:tag_breadcrumb_trail]
53: 
54:       node.node_info[:tag_breadcrumb_trail].each do |(params, cn_alcn), cached_list|
55:         cn = node.tree[cn_alcn]
56:         set_params(params.to_hash)
57:         list = breadcrumb_trail_list(cn)
58:         set_params({})
59: 
60:         if (list.map {|n| n.alcn} != cached_list) ||
61:             list.any? {|n| (r = n.routing_node(cn.lang)) && r != node && r.meta_info_changed?}
62:           node.flag(:dirty)
63:           break
64:         end
65:       end
66:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.