Media: Allow for the views manager to be extended. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4256ba0b48
commit
13a3cc30b2
|
@ -604,7 +604,8 @@
|
||||||
els = _.pluck( views, 'el' );
|
els = _.pluck( views, 'el' );
|
||||||
|
|
||||||
_.each( views, function( subview ) {
|
_.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.parent = this.view;
|
||||||
subviews.selector = selector;
|
subviews.selector = selector;
|
||||||
}, this );
|
}, this );
|
||||||
|
@ -656,17 +657,13 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
replace: function( $target, els ) {
|
replace: function( $target, els ) {
|
||||||
if ( this.view.replace )
|
|
||||||
return this.view.replace( $target, els );
|
|
||||||
|
|
||||||
$target.html( els );
|
$target.html( els );
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
attach: function( $target, els ) {
|
attach: function( $target, els ) {
|
||||||
if ( this.view.attach )
|
|
||||||
return this.view.attach( $target, els );
|
|
||||||
|
|
||||||
$target.append( els );
|
$target.append( els );
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -675,8 +672,11 @@
|
||||||
//
|
//
|
||||||
// The base view class.
|
// The base view class.
|
||||||
media.View = Backbone.View.extend({
|
media.View = Backbone.View.extend({
|
||||||
|
// The constructor for the `Views` manager.
|
||||||
|
Views: media.Views,
|
||||||
|
|
||||||
constructor: function() {
|
constructor: function() {
|
||||||
this.views = new media.Views( this, this.views );
|
this.views = new this.Views( this, this.views );
|
||||||
Backbone.View.apply( this, arguments );
|
Backbone.View.apply( this, arguments );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue