Media: Add render tracking to views. see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@22690 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3f57bfeb9d
commit
c14200e07b
@ -682,8 +682,10 @@
|
|||||||
subviews.selector = selector;
|
subviews.selector = selector;
|
||||||
}, this );
|
}, this );
|
||||||
|
|
||||||
if ( ! options.silent )
|
if ( ! options.silent ) {
|
||||||
|
_.each( views, this._maybeRender, this );
|
||||||
this[ method ]( $selector, els, options );
|
this[ method ]( $selector, els, options );
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
@ -755,6 +757,8 @@
|
|||||||
render: function() {
|
render: function() {
|
||||||
var root = this._views[''];
|
var root = this._views[''];
|
||||||
|
|
||||||
|
_.each( this.all(), this._maybeRender, this );
|
||||||
|
|
||||||
if ( root )
|
if ( root )
|
||||||
this.replace( this.view.$el, _.pluck( root, 'el' ) );
|
this.replace( this.view.$el, _.pluck( root, 'el' ) );
|
||||||
|
|
||||||
@ -763,6 +767,7 @@
|
|||||||
this.replace( this.view.$( selector ), _.pluck( views, 'el' ) );
|
this.replace( this.view.$( selector ), _.pluck( views, 'el' ) );
|
||||||
}, this );
|
}, this );
|
||||||
|
|
||||||
|
this.rendered = true;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -813,6 +818,16 @@
|
|||||||
$target.append( els );
|
$target.append( els );
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// #### Internal. Maybe render a view.
|
||||||
|
_maybeRender: function( view ) {
|
||||||
|
if ( ! view.views || view.views.rendered )
|
||||||
|
return;
|
||||||
|
|
||||||
|
view.render();
|
||||||
|
view.views.rendered = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1148,14 +1163,14 @@
|
|||||||
upload: state.get('upload'),
|
upload: state.get('upload'),
|
||||||
|
|
||||||
AttachmentView: state.get('AttachmentView')
|
AttachmentView: state.get('AttachmentView')
|
||||||
}).render() );
|
}) );
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadContent: function() {
|
uploadContent: function() {
|
||||||
// In the meantime, render an inline uploader.
|
// In the meantime, render an inline uploader.
|
||||||
this.content.view( new media.view.UploaderInline({
|
this.content.view( new media.view.UploaderInline({
|
||||||
controller: this
|
controller: this
|
||||||
}).render() );
|
}) );
|
||||||
},
|
},
|
||||||
|
|
||||||
// Sidebars
|
// Sidebars
|
||||||
|
Loading…
Reference in New Issue
Block a user