Ticket #22607: 22607.uploaded.diff
File 22607.uploaded.diff, 1.7 KB (added by , 13 years ago) |
---|
-
wp-includes/js/media-views.js
2805 2805 }, 2806 2806 2807 2807 initSortable: function() { 2808 var view = this, 2809 collection = this.collection, 2808 var collection = this.collection, 2810 2809 from; 2811 2810 2812 2811 if ( ! this.options.sortable || ! $.fn.sortable ) … … 2852 2851 2853 2852 // If the collection is sorted by menu order, 2854 2853 // update the menu order. 2855 view.saveMenuOrder(); 2856 2857 // Make sure any menu-order-related callbacks are bound. 2858 view.refreshSortable(); 2854 collection.saveMenuOrder(); 2859 2855 } 2860 2856 }); 2861 2857 … … 2876 2872 // If the `collection` has a `comparator`, disable sorting. 2877 2873 var collection = this.collection, 2878 2874 orderby = collection.props.get('orderby'), 2879 enabled = 'menuOrder' === orderby || ! collection.comparator, 2880 hasMenuOrder; 2875 enabled = 'menuOrder' === orderby || ! collection.comparator; 2881 2876 2882 2877 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 multiple2890 // 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 2896 2878 }, 2897 2879 2898 saveMenuOrder: function() {2899 this.collection.saveMenuOrder();2900 },2901 2902 2880 createAttachmentView: function( attachment ) { 2903 2881 var view = new this.options.AttachmentView({ 2904 2882 controller: this.controller,