Media: Add render tracking to views. see #21390.

git-svn-id: http://core.svn.wordpress.org/trunk@22690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-11-19 22:48:11 +00:00
parent c185f0c9bd
commit 663cde2c51
1 changed files with 18 additions and 3 deletions

View File

@ -682,8 +682,10 @@
subviews.selector = selector;
}, this );
if ( ! options.silent )
if ( ! options.silent ) {
_.each( views, this._maybeRender, this );
this[ method ]( $selector, els, options );
}
return this;
},
@ -755,6 +757,8 @@
render: function() {
var root = this._views[''];
_.each( this.all(), this._maybeRender, this );
if ( root )
this.replace( this.view.$el, _.pluck( root, 'el' ) );
@ -763,6 +767,7 @@
this.replace( this.view.$( selector ), _.pluck( views, 'el' ) );
}, this );
this.rendered = true;
return this;
},
@ -813,6 +818,16 @@
$target.append( els );
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'),
AttachmentView: state.get('AttachmentView')
}).render() );
}) );
},
uploadContent: function() {
// In the meantime, render an inline uploader.
this.content.view( new media.view.UploaderInline({
controller: this
}).render() );
}) );
},
// Sidebars