mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 12:58:25 +01:00
Media: Simplify upload error message construction.
Merges [40736] to the 4.7 branch. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40737 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f54b1461ac
commit
f5bc3b5a12
@ -328,15 +328,24 @@ function uploadError(fileObj, errorCode, message, uploader) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function uploadSizeError( up, file, over100mb ) {
|
function uploadSizeError( up, file ) {
|
||||||
var message;
|
var message, errorDiv;
|
||||||
|
|
||||||
if ( over100mb )
|
message = pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
|
||||||
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);
|
up.removeFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user