Make WordPress Core

Changeset 22649


Ignore:
Timestamp:
11/19/2012 12:54:18 AM (14 years ago)
Author:
koopersmith
Message:

Media: Allow for the views manager to be extended. see #21390.

File:
1 edited

Legend:

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

    r22648 r22649  
    605605
    606606                        _.each( views, function( subview ) {
    607                                 var subviews = subview.views = subview.views || new this.constructor( subview );
     607                                var constructor = subview.Views || media.Views,
     608                                        subviews = subview.views = subview.views || new constructor( subview );
    608609                                subviews.parent   = this.view;
    609610                                subviews.selector = selector;
    … …  
    657658
    658659                replace: function( $target, els ) {
    659                         if ( this.view.replace )
    660                                 return this.view.replace( $target, els );
    661 
    662660                        $target.html( els );
     661                        return this;
    663662                },
    664663
    665664                attach: function( $target, els ) {
    666                         if ( this.view.attach )
    667                                 return this.view.attach( $target, els );
    668 
    669665                        $target.append( els );
     666                        return this;
    670667                }
    671668        });
    … …  
    676673        // The base view class.
    677674        media.View = Backbone.View.extend({
     675                // The constructor for the `Views` manager.
     676                Views: media.Views,
     677
    678678                constructor: function() {
    679                         this.views = new media.Views( this, this.views );
     679                        this.views = new this.Views( this, this.views );
    680680                        Backbone.View.apply( this, arguments );
    681681                },
Note: See TracChangeset for help on using the changeset viewer.