Skip to content
This repository
Browse code

Allow method chaining in RJS elements [Rick Olson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3801 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 08967ead78d888ff058da014569932ccf04dceda 1 parent 382741f
David Heinemeier Hansson authored March 06, 2006
2  actionpack/Rakefile
@@ -116,7 +116,7 @@ end
116 116
 
117 117
 task :update_scriptaculous do
118 118
   for js in %w( controls dragdrop effects )
119  
-    system("svn export --force http://dev.rubyonrails.org/svn/rails/spinoffs/scriptaculous/src/#{js} #{File.dirname(__FILE__)}/lib/action_view/helpers/javascripts/")
  119
+    system("svn export --force http://dev.rubyonrails.org/svn/rails/spinoffs/scriptaculous/src/#{js}.js #{File.dirname(__FILE__)}/lib/action_view/helpers/javascripts/#{js}.js")
120 120
   end
121 121
 end
122 122
 
3  actionpack/lib/action_view/helpers/javascripts/dragdrop.js
@@ -558,9 +558,10 @@ var Sortable = {
558 558
   findElements: function(element, options) {
559 559
     if(!element.hasChildNodes()) return null;
560 560
     var elements = [];
  561
+    var only = options.only ? [options.only].flatten() : null;
561 562
     $A(element.childNodes).each( function(e) {
562 563
       if(e.tagName && e.tagName.toUpperCase()==options.tag.toUpperCase() &&
563  
-        (!options.only || (Element.hasClassName(e, options.only))))
  564
+        (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
564 565
           elements.push(e);
565 566
       if(options.tree) {
566 567
         var grandchildren = this.findElements(e, options);
9  actionpack/lib/action_view/helpers/javascripts/effects.js
@@ -918,3 +918,12 @@ Effect.Fold = function(element) {
918 918
       }} });
919 919
   }}, arguments[1] || {}));
920 920
 }
  921
+
  922
+if(Element.Methods) {
  923
+  Element.Methods.visualEffect = function(element, effect, options) {
  924
+    s = effect.gsub(/_/, '-').camelize();
  925
+    effect_class = s.charAt(0).toUpperCase() + s.substring(1);
  926
+    new Effect[effect_class](element, options);
  927
+    return $(element);
  928
+  }
  929
+}
9  railties/html/javascripts/effects.js
@@ -918,3 +918,12 @@ Effect.Fold = function(element) {
918 918
       }} });
919 919
   }}, arguments[1] || {}));
920 920
 }
  921
+
  922
+if(Element.Methods) {
  923
+  Element.Methods.visualEffect = function(element, effect, options) {
  924
+    s = effect.gsub(/_/, '-').camelize();
  925
+    effect_class = s.charAt(0).toUpperCase() + s.substring(1);
  926
+    new Effect[effect_class](element, options);
  927
+    return $(element);
  928
+  }
  929
+}

0 notes on commit 08967ea

Please sign in to comment.
Something went wrong with that request. Please try again.