From 39ec7ce6a93945bc97f599d8cb503711a66f3952 Mon Sep 17 00:00:00 2001 From: Bob Remeika Date: Wed, 4 Nov 2009 02:35:16 -0800 Subject: Removed duplication --- actionpack/lib/action_view/helpers/ajax_helper.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/ajax_helper.rb b/actionpack/lib/action_view/helpers/ajax_helper.rb index 807c943d2c..9f1ca138eb 100644 --- a/actionpack/lib/action_view/helpers/ajax_helper.rb +++ b/actionpack/lib/action_view/helpers/ajax_helper.rb @@ -49,16 +49,16 @@ module ActionView end def periodically_call_remote(options = {}) -# frequency = options[:frequency] || 10 # every ten seconds by default -# code = "new PeriodicalExecuter(function() {#{remote_function(options)}}, #{frequency})" -# javascript_tag(code) + attributes = extract_observer_attributes!(options) + attributes["data-js-type"] = "periodical_executer" + + script_decorator(attributes) end + #TODO: Should name change to a css query? - BR def observe_field(name, options = {}) options[:observed] = name - - attributes = extract_remote_attributes!(options) - attributes.merge!(extract_observer_attributes!(options)) + attributes = extract_observer_attributes!(options) attributes["data-js-type"] = "field_observer" script_decorator(attributes) @@ -139,7 +139,7 @@ module ActionView end def extract_observer_attributes!(options) - attributes = {} + attributes = extract_remote_attributes!(options) attributes["data-observed"] = options.delete(:observed) callback = options.delete(:function) @@ -151,7 +151,7 @@ module ActionView attributes["data-frequency"] = frequency.to_i end - attributes + purge_unused_attributes!(attributes) end def purge_unused_attributes!(attributes) -- cgit v1.2.3