From c5ee034c29fee5b1a41ca25e505672c3fa1ce7bd Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Mon, 19 Nov 2012 00:54:18 +0000 Subject: [PATCH] Media: Allow for the views manager to be extended. see #21390. git-svn-id: https://develop.svn.wordpress.org/trunk@22649 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/media-views.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index 56a32e4f7a..ae14aba652 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -604,7 +604,8 @@ els = _.pluck( views, 'el' ); _.each( views, function( subview ) { - var subviews = subview.views = subview.views || new this.constructor( subview ); + var constructor = subview.Views || media.Views, + subviews = subview.views = subview.views || new constructor( subview ); subviews.parent = this.view; subviews.selector = selector; }, this ); @@ -656,17 +657,13 @@ }, replace: function( $target, els ) { - if ( this.view.replace ) - return this.view.replace( $target, els ); - $target.html( els ); + return this; }, attach: function( $target, els ) { - if ( this.view.attach ) - return this.view.attach( $target, els ); - $target.append( els ); + return this; } }); @@ -675,8 +672,11 @@ // // The base view class. media.View = Backbone.View.extend({ + // The constructor for the `Views` manager. + Views: media.Views, + constructor: function() { - this.views = new media.Views( this, this.views ); + this.views = new this.Views( this, this.views ); Backbone.View.apply( this, arguments ); },