WordPress.org

Make WordPress Core

Changeset 22713


Ignore:
Timestamp:
11/20/2012 02:04:59 PM (8 years ago)
Author:
koopersmith
Message:

Media: Allow all galleries to be sortable. fixes #22488, see #21390.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/media-upload.js

    r22699 r22713  
    321321                selection.gallery = attachments.gallery;
    322322
     323                // Fetch the query's attachments, and then break ties from the
     324                // query to allow for sorting.
     325                selection.more().done( function() {
     326                    // Break ties with the query.
     327                    selection.props.set({ query: false });
     328                    selection.unmirror();
     329                    selection.props.unset('orderby');
     330                });
     331
    323332                return wp.media({
    324333                    frame:     'post',
  • trunk/wp-includes/js/media-views.js

    r22712 r22713  
    25412541
    25422542            this.initSortable();
     2543            this.collection.props.on( 'change:orderby', this.refreshSortable, this );
    25432544
    25442545            _.bindAll( this, 'css' );
     
    25502551
    25512552        destroy: function() {
     2553            this.collection.props.off( null, null, this );
    25522554            this.collection.off( 'add remove reset', null, this );
    25532555            this.model.off( 'change:edge change:gutter', this.css, this );
     
    26272629                this.$el.sortable( 'option', 'disabled', !! collection.comparator );
    26282630            }, this );
     2631        },
     2632
     2633        refreshSortable: function() {
     2634            if ( ! this.options.sortable || ! $.fn.sortable )
     2635                return;
     2636
     2637            // If the `collection` has a `comparator`, disable sorting.
     2638            this.$el.sortable( 'option', 'disabled', !! this.collection.comparator );
    26292639        },
    26302640
Note: See TracChangeset for help on using the changeset viewer.