mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
pad_impexp: Simplify creation of import failure message
This commit is contained in:
parent
890e16f6fc
commit
d869d96a2b
1 changed files with 9 additions and 14 deletions
|
@ -74,24 +74,19 @@ const padimpexp = (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const importErrorMessage = (status) => {
|
const importErrorMessage = (status) => {
|
||||||
let msg = '';
|
const known = [
|
||||||
|
'convertFailed',
|
||||||
if (status === 'convertFailed') {
|
'uploadFailed',
|
||||||
msg = html10n.get('pad.impexp.convertFailed');
|
'padHasData',
|
||||||
} else if (status === 'uploadFailed') {
|
'maxFileSize',
|
||||||
msg = html10n.get('pad.impexp.uploadFailed');
|
'permission',
|
||||||
} else if (status === 'padHasData') {
|
];
|
||||||
msg = html10n.get('pad.impexp.padHasData');
|
const msg = html10n.get(`pad.impexp.${known.indexOf(status) !== -1 ? status : 'copypaste'}`);
|
||||||
} else if (status === 'maxFileSize') {
|
|
||||||
msg = html10n.get('pad.impexp.maxFileSize');
|
|
||||||
} else if (status === 'permission') {
|
|
||||||
msg = html10n.get('pad.impexp.permission');
|
|
||||||
}
|
|
||||||
|
|
||||||
const showError = (fade) => {
|
const showError = (fade) => {
|
||||||
$('#importmessagefail').html(
|
$('#importmessagefail').html(
|
||||||
`<strong style="color: red">${html10n.get('pad.impexp.importfailed')}:</strong> ` +
|
`<strong style="color: red">${html10n.get('pad.impexp.importfailed')}:</strong> ` +
|
||||||
`${msg || html10n.get('pad.impexp.copypaste', '')}`)[(fade ? 'fadeIn' : 'show')]();
|
`${msg}`)[(fade ? 'fadeIn' : 'show')]();
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($('#importexport .importmessage').is(':visible')) {
|
if ($('#importexport .importmessage').is(':visible')) {
|
||||||
|
|
Loading…
Reference in a new issue