Make it a bit more readable

This commit is contained in:
Jiiks 2018-08-15 10:10:16 +03:00
parent b971b716bf
commit 11eed2c89d
1 changed files with 21 additions and 19 deletions

View File

@ -232,17 +232,20 @@ export default class Modals {
static showContentManagerErrors(clear = true) { static showContentManagerErrors(clear = true) {
// Get any errors from PluginManager and ThemeManager // Get any errors from PluginManager and ThemeManager
const errors = ([]).concat(PluginManager.errors).concat(ThemeManager.errors); const errors = ([]).concat(PluginManager.errors).concat(ThemeManager.errors);
if (errors.length) { if (!errors.length) return;
const pmErrCount = PluginManager.errors.length;
const tmErrCount = ThemeManager.errors.length;
const bothErr = pmErrCount && tmErrCount;
const modal = this.error({ const modal = this.error({
header: header: `
`${(PluginManager.errors.length && ThemeManager.errors.length ? '' : ${bothErr ? '' : pmErrCount ? PluginManager.moduleName : ThemeManager.moduleName} -
`${PluginManager.errors.length ? PluginManager.moduleName : ThemeManager.moduleName } - `) + ${pmErrCount ? `${pmErrCount} ${PluginManager.contentType}${pmErrCount !== 1 ? 's' : ''}` : ''}
(PluginManager.errors.length ? `${PluginManager.errors.length} ${PluginManager.contentType}${PluginManager.errors.length !== 1 ? 's' : ''}` : '') + ${pmErrCount && tmErrCount ? ' and ' : ''}
(PluginManager.errors.length && ThemeManager.errors.length ? ' and ' : '') + ${tmErrCount ? `${tmErrCount} ${ThemeManager.contentType}${tmErrCount !== 1 ? 's' : ''}` : ''} failed to load
(ThemeManager.errors.length ? `${ThemeManager.errors.length} ${ThemeManager.contentType}${ThemeManager.errors.length !== 1 ? 's' : ''}` : '') `,
} failed to load`, module: bothErr ? 'Content Manager' : pmErrCount ? PluginManager.moduleName : ThemeManager.moduleName,
module: (PluginManager.errors.length && ThemeManager.errors.length ? 'Content Manager' :
(PluginManager.errors.length ? PluginManager.moduleName : ThemeManager.moduleName)),
type: 'err', type: 'err',
content: errors content: errors
}); });
@ -254,7 +257,6 @@ export default class Modals {
return modal; return modal;
} }
}
/** /**
* Creates a new settings modal and adds it to the open stack. * Creates a new settings modal and adds it to the open stack.