Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@dhh dhh authored
View
2  actionpack/Rakefile
@@ -116,7 +116,7 @@ end
task :update_scriptaculous do
for js in %w( controls dragdrop effects )
- system("svn export --force http://dev.rubyonrails.org/svn/rails/spinoffs/scriptaculous/src/#{js} #{File.dirname(__FILE__)}/lib/action_view/helpers/javascripts/")
+ 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")
end
end
View
3  actionpack/lib/action_view/helpers/javascripts/dragdrop.js
@@ -558,9 +558,10 @@ var Sortable = {
findElements: function(element, options) {
if(!element.hasChildNodes()) return null;
var elements = [];
+ var only = options.only ? [options.only].flatten() : null;
$A(element.childNodes).each( function(e) {
if(e.tagName && e.tagName.toUpperCase()==options.tag.toUpperCase() &&
- (!options.only || (Element.hasClassName(e, options.only))))
+ (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
elements.push(e);
if(options.tree) {
var grandchildren = this.findElements(e, options);
View
9 actionpack/lib/action_view/helpers/javascripts/effects.js
@@ -918,3 +918,12 @@ Effect.Fold = function(element) {
}} });
}}, arguments[1] || {}));
}
+
+if(Element.Methods) {
+ Element.Methods.visualEffect = function(element, effect, options) {
+ s = effect.gsub(/_/, '-').camelize();
+ effect_class = s.charAt(0).toUpperCase() + s.substring(1);
+ new Effect[effect_class](element, options);
+ return $(element);
+ }
+}
View
9 railties/html/javascripts/effects.js
@@ -918,3 +918,12 @@ Effect.Fold = function(element) {
}} });
}}, arguments[1] || {}));
}
+
+if(Element.Methods) {
+ Element.Methods.visualEffect = function(element, effect, options) {
+ s = effect.gsub(/_/, '-').camelize();
+ effect_class = s.charAt(0).toUpperCase() + s.substring(1);
+ new Effect[effect_class](element, options);
+ return $(element);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.