Media modal: fix the progress bar in the attachment thumbnail. Props gcorne, fixes #29367

Built from https://develop.svn.wordpress.org/trunk@29609


git-svn-id: http://core.svn.wordpress.org/trunk@29383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-08-25 22:45:16 +00:00
parent 92ee5b230c
commit 04e28b468c
3 changed files with 9 additions and 3 deletions

View File

@ -4680,12 +4680,13 @@
if ( options.rerenderOnModelChange ) {
this.model.on( 'change', this.render, this );
} else {
this.model.on( 'change:percent', this.progress, this );
}
this.model.on( 'change:title', this._syncTitle, this );
this.model.on( 'change:caption', this._syncCaption, this );
this.model.on( 'change:artist', this._syncArtist, this );
this.model.on( 'change:album', this._syncAlbum, this );
this.model.on( 'change:percent', this.progress, this );
// Update the selection.
this.model.on( 'add', this.select, this );
@ -4753,10 +4754,15 @@
options.allowLocalEdits = true;
}
if ( options.uploading && ! options.percent ) {
options.percent = 0;
}
this.views.detach();
this.$el.html( this.template( options ) );
this.$el.toggleClass( 'uploading', options.uploading );
if ( options.uploading ) {
this.$bar = this.$('.media-progress-bar div');
} else {

File diff suppressed because one or more lines are too long

View File

@ -428,7 +428,7 @@ function wp_print_media_templates() {
<div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
<div class="thumbnail">
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div>
<div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div>
<# } else if ( 'image' === data.type && data.sizes ) { #>
<div class="centered">
<img src="{{ data.size.url }}" draggable="false" alt="" />