lib/hobo/rapid_helper.rb in hobo-1.0.3 vs lib/hobo/rapid_helper.rb in hobo-1.1.0.pre0
- old
+ new
@@ -1,7 +1,18 @@
module Hobo::RapidHelper
+ def comma_split(x)
+ case x
+ when nil
+ []
+ when String
+ x.strip.split(/\s*,\s*/)
+ else
+ x.compact.map{|e| comma_split(e)}.flatten
+ end
+ end
+
def rapid_build_callbacks(options)
callbacks = {}
options.each do |callback, code|
if AJAX_CALLBACKS.include?(callback.to_sym)
name = 'on' + callback.to_s.capitalize
@@ -111,10 +122,10 @@
AJAX_CALLBACKS = [ :before, :success, :failure, :complete ]
- AJAX_ATTRS = AJAX_CALLBACKS + [ :type, :method,
+ AJAX_ATTRS = AJAX_CALLBACKS + [ :update, :type, :method,
:script, :form, :params, :confirm, :message,
:reset_form, :refocus_form, :result_update, :spinner_next_to ]
def through_collection_names(object=this)