Sha256: 96cc8178328e9cc8db3ed4e6ae3c152eebe998e9eb2a1dd92518de12b49df3d6

Contents?: true

Size: 1.44 KB

Versions: 33

Compression:

Stored size: 1.44 KB

Contents

/* hjq-sortable-collection */
(function($) {
    var methods = {
        init: function(annotations) {
            var options = $.extend({update: methods.update}, this.hjq('getOptions', annotations));
            this.sortable(options);
        },

        update: function() {
            var that=$(this);
            var annotations=that.data('rapid')['sortable-collection'];
            var roptions = that.hjq('buildRequest', {type: 'post',
                                                     attrs: annotations.ajax_attrs
                                                    });
            roptions.data['authenticity_token']=that.hjq('pageData').form_auth_token.value;
            roptions.data=$.param(roptions.data);
            that.children("*[data-rapid-context]").each(function(i) {
                roptions.data = roptions.data+"&"+annotations.reorder_parameter+"[]="+$(this).hjq('contextId');
            });

            $.ajax(annotations.reorder_url, roptions);
            return that;
        }

    };


    $.fn.hjq_sortable_collection = function( method ) {

        if ( methods[method] ) {
            return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
        } else if ( typeof method === 'object' || ! method ) {
            return methods.init.apply( this, arguments );
        } else {
            $.error( 'Method ' +  method + ' does not exist on hjq_sortable_collection' );
        }
    };

})( jQuery );

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
hobo_jquery_ui-2.2.6 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.2.5 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.2.4 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.2.3 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.2.2 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.2.1 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.2.0 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.1.2 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.1.1 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.1.0 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.1.0.pre4 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.1.0.pre3 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.1.0.pre2 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.1.0.pre1 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.0.1 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.0.0 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.0.0.pre10 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.0.0.pre9 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery_ui-2.0.0.pre8 vendor/assets/javascripts/hobo-jquery-ui/hjq-sortable-collection.js
hobo_jquery-2.0.0.pre7 vendor/assets/javascripts/hobo-jquery/hjq-sortable-collection.js