Class: Webgen::Tag::Menu
- Inherits:
-
Object
- Object
- Webgen::Tag::Menu
- Includes:
- Base, WebsiteAccess
- Defined in:
- lib/webgen/tag/menu.rb
Overview
Generates a menu that can be configured extensively.
Defined Under Namespace
Classes: MenuNode
Instance Method Summary collapse
-
#call(tag, body, context) ⇒ Object
Generate the menu.
-
#initialize ⇒ Menu
constructor
:nodoc:.
Methods included from Base
#create_params_hash, #create_tag_params, #param, #set_params
Methods included from WebsiteAccess
Methods included from Loggable
Constructor Details
#initialize ⇒ Menu
:nodoc:
52 53 54 |
# File 'lib/webgen/tag/menu.rb', line 52 def initialize #:nodoc: website.blackboard.add_listener(:node_changed?, method(:node_changed?)) end |
Instance Method Details
#call(tag, body, context) ⇒ Object
Generate the menu.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/webgen/tag/menu.rb', line 57 def call(tag, body, context) tree = (context.content_node) (context.dest_node.node_info[:tag_menu_menus] ||= {})[[@params.to_a.sort, context.content_node.alcn]] = (tree ? tree.to_lcn_list : nil) if !tree || tree.children.empty? '' elsif param('tag.menu.nested') create_output_nested(context, tree) else create_output_not_nested(context, tree) end end |