Sha256: 7407ed25572416f1af0dcb730bd1fae07b2484e0516bed42d51ee5d210450894
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
module SlideMenuHelper def p_slide_menu(id,options={},&block) output = slide_menu_encode_markup(id,options,&block) output += slide_menu_encode_script(id,options) end protected def slide_menu_encode_markup(id,options={},&block) clientid = sanitize_to_id(id) options = options.stringify_keys options = options.merge(:id => clientid) output = content_tag('ul', options) do capture(&block) end output.html_safe end def slide_menu_encode_script(id,options={}) options = options.stringify_keys clientid = sanitize_to_id(id) widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid options_ui = options options_ui = options_ui.merge(:id => clientid) options_ui = options_ui.to_json script = '$(function() {' script += "PrimeFaces.cw('SlideMenu','#{widgetvar}',#{options_ui})" script += '});' p_javascript_tag(script, "id" => clientid+"_s") end end
Version data entries
4 entries across 4 versions & 1 rubygems