From 8506cc5b4051723cfdbb88d21e3f7db12404bf81 Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Fri, 19 Nov 2010 16:30:49 -0500 Subject: [PATCH 1/2] [#861] allow :preamble and :postamble options to be sent to ajax_update_response. --- vendor/plugins/hobo/hobo/lib/hobo/controller.rb | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/vendor/plugins/hobo/hobo/lib/hobo/controller.rb b/vendor/plugins/hobo/hobo/lib/hobo/controller.rb index a7a195c..7aaec50 100644 --- a/vendor/plugins/hobo/hobo/lib/hobo/controller.rb +++ b/vendor/plugins/hobo/hobo/lib/hobo/controller.rb @@ -78,12 +78,12 @@ module Hobo end - def ajax_update_response(page_path, render_specs, results={}) + def ajax_update_response(page_path, render_specs, results={}, options={}) @template.send(:_evaluate_assigns_and_ivars) renderer = Dryml.page_renderer(@template, [], page_path) if page_path render :update do |page| - page << "var _update = typeof Hobo == 'undefined' ? Element.update : Hobo.updateElement;" + page << options[:preamble] || "var _update = typeof Hobo == 'undefined' ? Element.update : Hobo.updateElement;" for spec in render_specs function = spec[:function] || "_update" dom_id = spec[:id] @@ -99,6 +99,7 @@ module Hobo end end page << renderer.part_contexts_storage if renderer + page << options[:postamble] if options[:postamble] end end -- 1.7.3.2