From 6d711428b49ff16e4eb976c01b8dde2bc8f227a7 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 3 Dec 2012 04:54:03 +0000 Subject: [PATCH] Media: Don't add menu_order to newly uploaded attachments, to match 3.4 behavior. Reverts a bit of [22967]. props koopersmith. fixes #22607. git-svn-id: http://core.svn.wordpress.org/trunk@22985 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/media-views.js | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index 92d1ba77f2..3bc1fb0497 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -2813,8 +2813,7 @@ }, initSortable: function() { - var view = this, - collection = this.collection, + var collection = this.collection, from; if ( ! this.options.sortable || ! $.fn.sortable ) @@ -2860,10 +2859,7 @@ // If the collection is sorted by menu order, // update the menu order. - view.saveMenuOrder(); - - // Make sure any menu-order-related callbacks are bound. - view.refreshSortable(); + collection.saveMenuOrder(); } }); @@ -2884,27 +2880,9 @@ // If the `collection` has a `comparator`, disable sorting. var collection = this.collection, orderby = collection.props.get('orderby'), - enabled = 'menuOrder' === orderby || ! collection.comparator, - hasMenuOrder; + enabled = 'menuOrder' === orderby || ! collection.comparator; this.$el.sortable( 'option', 'disabled', ! enabled ); - - // Check if any attachments have a specified menu order. - hasMenuOrder = this.collection.any( function( attachment ) { - return attachment.get('menuOrder'); - }); - - // Always unbind the `saveMenuOrder` callback to prevent multiple - // callbacks stacking up. - this.collection.off( 'change:uploading', this.saveMenuOrder, this ); - - if ( hasMenuOrder ) - this.collection.on( 'change:uploading', this.saveMenuOrder, this ); - - }, - - saveMenuOrder: function() { - this.collection.saveMenuOrder(); }, createAttachmentView: function( attachment ) {