Media: Simplify upload error message construction.

Merges [40736] to the 3.7 branch.

Built from https://develop.svn.wordpress.org/branches/3.7@40747


git-svn-id: http://core.svn.wordpress.org/branches/3.7@40605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2017-05-16 18:05:51 +00:00
parent f5fca82e63
commit 8ae6705fd2
2 changed files with 17 additions and 8 deletions

View File

@ -334,15 +334,24 @@ function uploadError(fileObj, errorCode, message, uploader) {
}
}
function uploadSizeError( up, file, over100mb ) {
var message;
function uploadSizeError( up, file ) {
var message, errorDiv;
if ( over100mb )
message = pluploadL10n.big_upload_queued.replace('%s', file.name) + ' ' + pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>');
else
message = pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
jQuery('#media-items').append('<div id="media-item-' + file.id + '" class="media-item error"><p>' + message + '</p></div>');
// Construct the error div.
errorDiv = jQuery( '<div />' )
.attr( {
'id': 'media-item-' + file.id,
'class': 'media-item error'
} )
.append(
jQuery( '<p />' )
.text( message )
);
// Append the error.
jQuery('#media-items').append( errorDiv );
up.removeFile(file);
}

File diff suppressed because one or more lines are too long