app/helpers/skyline/dialog_helper.rb in skylinecms-3.0.8 vs app/helpers/skyline/dialog_helper.rb in skylinecms-3.1.0

- old
+ new

@@ -6,25 +6,26 @@ 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 + options = options_for_render.slice!(:partial, :locals) content = render(options_for_render) end - p = "var s = function(){" + 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 + + p = "(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 << "}()" + p << "})()" end end \ No newline at end of file