Object
Generates a breadcrumb trail for the page. This is especially useful when pages are in deep hierarchies of directories.
Create the breadcrumb trail.
# File lib/webgen/tag/breadcrumbtrail.rb, line 16 def call(tag, body, context) out = breadcrumb_trail_list(context.content_node) (context.dest_node.node_info[:tag_breadcrumb_trail] ||= {})[[@params.to_a.sort, context.content_node.alcn]] = out.map {|n| n.alcn} out = out.map {|n| context.dest_node.link_to(n, :lang => context.content_node.lang) }. join(param('tag.breadcrumbtrail.separator')) log(:debug) { "Breadcrumb trail for <#{context.content_node}>: #{out}" } out end
Check if the breadcrumb trails for node have changed.
# File lib/webgen/tag/breadcrumbtrail.rb, line 50 def node_changed?(node) return if !node.node_info[:tag_breadcrumb_trail] node.node_info[:tag_breadcrumb_trail].each do |(params, cn_alcn), cached_list| cn = node.tree[cn_alcn] set_params(params.to_hash) list = breadcrumb_trail_list(cn) set_params({}) if (list.map {|n| n.alcn} != cached_list) || list.any? {|n| (r = n.routing_node(cn.lang)) && r != node && r.meta_info_changed?} node.flag(:dirty) break end end end
Generated with the Darkfish Rdoc Generator 2.