Sha256: 26f1f8f7d8d8fe1f9bf4b3c28c3e8b76312eee44444b5cfa2d2df37f3a6c148a
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# -*- encoding: utf-8 -*- require 'webgen/tag' module Webgen class Tag # Generates a menu that can be extensively configured by using the available Webgen::NodeFinder # options. module Menu # Generate the menu. def self.call(tag, body, context) options = context[:config]['tag.menu.options'] context[:nodes] = context.website.ext.node_finder.find(options, context.content_node) context.website.ext.item_tracker.add(context.dest_node, :nodes, :node_finder_option_set, {:opts => options, :ref_alcn => context.content_node.alcn}, :meta_info) if context[:nodes].empty? '' else Webgen::Tag.render_tag_template(context, "menu") end end # Return style information (node is selected, ...) and a link from +dest_node+ to +node+. # # This method can be used in a menu template. def self.menu_item_details(dest_node, node, lang, level, has_submenu, config) styles = [config['tag.menu.item_level_class'] + level.to_s] styles << config['tag.menu.item_submenu_class'] if has_submenu styles << config['tag.menu.item_submenu_inhierarchy_class'] if node.is_ancestor_of?(dest_node) styles << config['tag.menu.item_selected_class'] if node == dest_node style = "class=\"#{styles.join(' ')}\"" if styles.length > 0 link = dest_node.link_to(node, lang) [style, link] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webgen-1.1.0 | lib/webgen/tag/menu.rb |
webgen-1.0.0 | lib/webgen/tag/menu.rb |