- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::YUIMenu
::xowiki::YUIMenu create ... \
[ -autorender (default "false") ] \
[ -configuration (default "{}") ] \
[ -footer footer ] \
[ -header header ] \
[ -shadow shadow ]
Defined in
Class Relations
- class: ::xo::tdom::Class
- superclass: ::xowiki::Menu
- subclass: ::xowiki::YUIContextMenu, ::xowiki::YUIMenuBar
::xo::tdom::Class create ::xowiki::YUIMenu \ -superclass ::xowiki::MenuMethods (to be applied on instances)
autorender (setter)
configuration (setter)
footer (setter)
header (setter)
init (scripted)
::xowiki::Includelet require_YUI_CSS -ajaxhelper 1 "menu/assets/skins/sam/menu.css" ::xowiki::Includelet require_YUI_JS -ajaxhelper 1 "yahoo-dom-event/yahoo-dom-event.js" ::xowiki::Includelet require_YUI_JS -ajaxhelper 1 "container/container_core-min.js" ::xowiki::Includelet require_YUI_JS -ajaxhelper 1 "menu/menu-min.js" nextrender (scripted, public)
<instance of xowiki::YUIMenu> renderhttp://developer.yahoo.com/yui/menu/
- Testcases:
- No testcase defined.
append :CSSclass " yuimenu" set :extrajs "" # I want the menu to show up when JS is disabled # This gets overridden by JS, so its only relevant for the non-JS version #set :style "visibility: visible; position: relative;" html::div [:get_attributes {CSSclass class} id style] { # Header html::t \n if {[info exists :header]} { html::div -class "hd" { html::t [:header] } } # Body html::t \n html::div -class "bd" { foreach group [:split_menu_groups [:children]] { html::ul -class yuiml { foreach menuitemlist $group {$menuitemlist render} } } } # Footer if {[info exists :footer]} { html::div -class "ft" { html::t [:footer] } } # Shadow if {[info exists :shadow]} { html::div -class "yui-menu-shadow" {} } # JavaScript # only "root-level" menus need JS # TODO: is this parent-check sufficient / future-safe? if {[info exists :__parent]} { # # propagate extrajs from rendering # #ns_log notice "### propagate extrajs <${:extrajs}> from [:info class] to [${:__parent} info class]" ${:__parent} append extrajs ${:extrajs} } else { html::script -nonce [security::csp::nonce] -type "text/javascript" { html::t "var [:js_name] = new YAHOO.widget.Menu(\"[:id]\", ${:configuration});" html::t " [:js_name].render(); [:js_name].show(); ${:extrajs} " } } }shadow (setter)
split_menu_groups (scripted)
# # split the list of entries into groups, which will be separated # with lines in the rendering # set result [list] if {[llength $list] < 1} {return $result} set group_name [[lindex $list 0] group] set group_list [list] foreach e $list { set gn [$e group] if {$gn ne $group_name} { lappend result $group_list set group_name $gn set group_list [list] } lappend group_list $e } lappend result $group_list return $result
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables