Sha256: be018d97ba81b8205e10b2fff6ddc88b64f8fa2ad7bab405679585df963f2965
Contents?: true
Size: 1.13 KB
Versions: 4
Compression:
Stored size: 1.13 KB
Contents
module DialogHelper def p_dialog(id,options={},&block) output = dialog_encode_markup(id,options,&block) output += dialog_encode_script(id,options) end protected def dialog_encode_markup(id,options={},&block) clientid = sanitize_to_id(id) options = options.stringify_keys options = options.merge(:id => clientid) output = content_tag(:div, options) do capture(&block) end output.html_safe end def dialog_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('Dialog','#{widgetvar}',#{options_ui})" script += '});' p_javascript_tag(script, "id" => clientid+"_s") end end
Version data entries
4 entries across 4 versions & 1 rubygems