Ticket #22607: 22607.uploaded.diff

File 22607.uploaded.diff, 1.7 KB (added by koopersmith, 6 months ago)
Line 
1Index: wp-includes/js/media-views.js
2===================================================================
3--- wp-includes/js/media-views.js       (revision 22983)
4+++ wp-includes/js/media-views.js       (working copy)
5@@ -2805,8 +2805,7 @@
6                },
7 
8                initSortable: function() {
9-                       var view = this,
10-                               collection = this.collection,
11+                       var collection = this.collection,
12                                from;
13 
14                        if ( ! this.options.sortable || ! $.fn.sortable )
15@@ -2852,10 +2851,7 @@
16 
17                                        // If the collection is sorted by menu order,
18                                        // update the menu order.
19-                                       view.saveMenuOrder();
20-
21-                                       // Make sure any menu-order-related callbacks are bound.
22-                                       view.refreshSortable();
23+                                       collection.saveMenuOrder();
24                                }
25                        });
26 
27@@ -2876,29 +2872,11 @@
28                        // If the `collection` has a `comparator`, disable sorting.
29                        var collection = this.collection,
30                                orderby = collection.props.get('orderby'),
31-                               enabled = 'menuOrder' === orderby || ! collection.comparator,
32-                               hasMenuOrder;
33+                               enabled = 'menuOrder' === orderby || ! collection.comparator;
34 
35                        this.$el.sortable( 'option', 'disabled', ! enabled );
36-
37-                       // Check if any attachments have a specified menu order.
38-                       hasMenuOrder = this.collection.any( function( attachment ) {
39-                               return attachment.get('menuOrder');
40-                       });
41-
42-                       // Always unbind the `saveMenuOrder` callback to prevent multiple
43-                       // callbacks stacking up.
44-                       this.collection.off( 'change:uploading', this.saveMenuOrder, this );
45-
46-                       if ( hasMenuOrder )
47-                               this.collection.on( 'change:uploading', this.saveMenuOrder, this );
48-
49                },
50 
51-               saveMenuOrder: function() {
52-                       this.collection.saveMenuOrder();
53-               },
54-
55                createAttachmentView: function( attachment ) {
56                        var view = new this.options.AttachmentView({
57                                controller: this.controller,