Make WordPress Core

Ticket #22607: 22607.uploaded.diff

File 22607.uploaded.diff, 1.7 KB (added by koopersmith, 13 years ago)
  • wp-includes/js/media-views.js

     
    28052805                },
    28062806
    28072807                initSortable: function() {
    2808                         var view = this,
    2809                                 collection = this.collection,
     2808                        var collection = this.collection,
    28102809                                from;
    28112810
    28122811                        if ( ! this.options.sortable || ! $.fn.sortable )
     
    28522851
    28532852                                        // If the collection is sorted by menu order,
    28542853                                        // update the menu order.
    2855                                         view.saveMenuOrder();
    2856 
    2857                                         // Make sure any menu-order-related callbacks are bound.
    2858                                         view.refreshSortable();
     2854                                        collection.saveMenuOrder();
    28592855                                }
    28602856                        });
    28612857
     
    28762872                        // If the `collection` has a `comparator`, disable sorting.
    28772873                        var collection = this.collection,
    28782874                                orderby = collection.props.get('orderby'),
    2879                                 enabled = 'menuOrder' === orderby || ! collection.comparator,
    2880                                 hasMenuOrder;
     2875                                enabled = 'menuOrder' === orderby || ! collection.comparator;
    28812876
    28822877                        this.$el.sortable( 'option', 'disabled', ! enabled );
    2883 
    2884                         // Check if any attachments have a specified menu order.
    2885                         hasMenuOrder = this.collection.any( function( attachment ) {
    2886                                 return attachment.get('menuOrder');
    2887                         });
    2888 
    2889                         // Always unbind the `saveMenuOrder` callback to prevent multiple
    2890                         // callbacks stacking up.
    2891                         this.collection.off( 'change:uploading', this.saveMenuOrder, this );
    2892 
    2893                         if ( hasMenuOrder )
    2894                                 this.collection.on( 'change:uploading', this.saveMenuOrder, this );
    2895 
    28962878                },
    28972879
    2898                 saveMenuOrder: function() {
    2899                         this.collection.saveMenuOrder();
    2900                 },
    2901 
    29022880                createAttachmentView: function( attachment ) {
    29032881                        var view = new this.options.AttachmentView({
    29042882                                controller: this.controller,