WordPress.org

Make WordPress Core

Changeset 27171


Ignore:
Timestamp:
02/13/2014 07:36:01 AM (6 years ago)
Author:
nacin
Message:

Update media-views and wp.Backbone.View for Backbone 1.1.

  • Collection set/add/remove/reset methods now return models, not this, so they can no longer be chained.
  • Options passed to Backbone.View's constructor are no longer attached automatically. wp.Backbone.View now does this automatically.

See [27170] for Backbone 1.1 itself.

props gcorne.
fixes #26799.

Location:
trunk/src/wp-includes/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-views.js

    r27164 r27171  
    35673567                }
    35683568
    3569                 selection.add( models ).single( model );
     3569                selection.add( models );
     3570                selection.single( model );
    35703571                return;
    35713572
     
    35733574            // status, regardless of whether the model is the single model.
    35743575            } else if ( 'toggle' === method ) {
    3575                 selection[ this.selected() ? 'remove' : 'add' ]( model ).single( model );
     3576                selection[ this.selected() ? 'remove' : 'add' ]( model );
     3577                selection.single( model );
    35763578                return;
    35773579            }
     
    35903592                // selection. By default, we `reset` the selection, but the
    35913593                // `method` can be set to `add` the model to the selection.
    3592                 selection[ method ]( model ).single( model );
     3594                selection[ method ]( model );
     3595                selection.single( model );
    35933596            }
    35943597        },
     
    39953998                    collection.remove( model, {
    39963999                        silent: true
    3997                     }).add( model, {
     4000                    });
     4001                    collection.add( model, {
    39984002                        silent: true,
    39994003                        at:     ui.item.index()
  • trunk/src/wp-includes/js/wp-backbone.js

    r24368 r27171  
    341341        Subviews: wp.Backbone.Subviews,
    342342
    343         constructor: function() {
     343        constructor: function( options ) {
    344344            this.views = new this.Subviews( this, this.views );
    345345            this.on( 'ready', this.ready, this );
     346
     347            this.options = options || {};
    346348
    347349            Backbone.View.apply( this, arguments );
Note: See TracChangeset for help on using the changeset viewer.