Topic: Mootools + Rails + Sortables = ?

I don't know if any of you are using Mootools out there, but I'm trying to, and it's quite effective... for some things. However, I just cannot make my Sortables work. Have a look (javascript):

    window.onDomReady(function() {

            var list = $$(".handle");
            var click = $("sort_pages");
            list.each(function(e) {
                var fx = new Fx.Slide(e, {mode:"horizontal", transition:Fx.Transitions.Bounce.easeOut, duration:1000});
                fx.hide();
                click.addEvent("click", function() {
                    fx.toggle();
                });
            });
           
            function s(element, options) {
                var str = [];
              var key = encodeURIComponent(options.key || element.id);
              var elements = $A(element.getElements(options.tag || ''));
              elements.each(function(el, i) {
                  str.push(key+'['+el.id+']='+i);
              });
              return str.join('&');
            }

            new Sortables($("pages"), {
                handles: $$(".handle"),
                onComplete: function() {
                    var result = s($("pages"), {tag:'tr', key:'page'});
                    var url = '<%= url_for :controller => :pages, :action => :reorder %>?' + result;
                    // $("Header").appendText(url);
                    new Ajax(url, {method: 'get'}).request();
                }
            });

    });


and the controller:

    def reorder
        @pages = Page.find(:all, :conditions => ["site_id = ?", session[:site].id])
        for page in @pages
            params = params["page"][page.id]
            page.position = params
            page.save
        end
    end

Thanks in advance!

Re: Mootools + Rails + Sortables = ?

What exactly isn't working?

(don't expect me to elaborate on this, btw, I r javascript newb)

Re: Mootools + Rails + Sortables = ?

i tried using mootools with prototype, broke my sortables code.

took me ages to work out what was happening, fiancee was really impressed :-(