Media: Add uploader error detection to the inline uploader view as well. see #21390.

git-svn-id: http://core.svn.wordpress.org/trunk@22824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-11-22 12:35:05 +00:00
parent c5991558be
commit 27e8de7e3a
3 changed files with 23 additions and 6 deletions

View File

@ -797,15 +797,16 @@ a.media-modal-close {
text-decoration: none;
}
.media-uploader-status .upload-error {
margin: 8px 0 0 0;
.upload-errors .upload-error {
max-width: 400px;
margin: 8px auto 0 auto;
padding: 8px;
border: 1px #c00 solid;
background: #ffebe8;
border-radius: 3px;
}
.media-uploader-status .upload-error-label {
.upload-errors .upload-error-label {
padding: 2px 4px;
margin-right: 8px;
font-weight: bold;
@ -815,7 +816,7 @@ a.media-modal-close {
border-radius: 3px;
}
.media-uploader-status .upload-error-message {
.upload-errors .upload-error-message {
display: block;
padding-top: 8px;
color: #b44;

View File

@ -1792,6 +1792,21 @@
if ( ! this.options.$browser && this.controller.uploader )
this.options.$browser = this.controller.uploader.$browser;
wp.Uploader.errors.on( 'add', this.error, this );
},
dispose: function() {
wp.Uploader.errors.off( null, null, this );
media.View.prototype.dispose.apply( this, arguments );
return this;
},
error: function( error ) {
this.views.set( '.upload-errors', new media.view.UploaderStatusError({
filename: error.get('file').name,
message: error.get('message')
}) );
},
ready: function() {

View File

@ -1497,6 +1497,8 @@ function wp_print_media_templates( $attachment ) {
<a href="#" class="browser button button-hero"><?php _e( 'Select Files' ); ?></a>
</div>
<div class="upload-errors"></div>
<div class="post-upload-ui">
<?php do_action( 'pre-upload-ui' ); ?>
<?php do_action( 'pre-plupload-upload-ui' ); ?>
@ -1545,8 +1547,7 @@ function wp_print_media_templates( $attachment ) {
<span class="upload-detail-separator">&ndash;</span>
<span class="upload-filename"></span>
</div>
<div class="upload-errors">
</div>
<div class="upload-errors"></div>
</script>
<script type="text/html" id="tmpl-uploader-status-error">