Sha256: 7fbbe9d67e65c4aa3a2c2c863307b527f0c146134b0ee27d4b5a008fc0cc2298
Contents?: true
Size: 899 Bytes
Versions: 4
Compression:
Stored size: 899 Bytes
Contents
module Skyline::DialogHelper def dialog(title,*args,&block) options_for_render = args.extract_options! options_for_render.reverse_merge! :width => "auto", :height => "auto" if args.any? content = args.last options = options_for_render else options = options_for_render.slice!(:partial, :locals) options.each do |k,v| options[k] = case v when String,Symbol : "'" + escape_javascript(v.to_s) + "'" when Hash : options_for_javascript(v) else v end end content = render(options_for_render) end p = "var s = function(){" p << "var sd = new Skyline.Dialog(#{options_for_javascript(options)});" p << "sd.setTitle('#{escape_javascript(title)}');" p << "sd.setContent('#{escape_javascript(content)}');" p << "sd.setup(); sd.show();" p << "}()" end end
Version data entries
4 entries across 4 versions & 2 rubygems