Make it a bit more readable
This commit is contained in:
parent
b971b716bf
commit
11eed2c89d
|
@ -232,17 +232,20 @@ export default class Modals {
|
|||
static showContentManagerErrors(clear = true) {
|
||||
// Get any errors from PluginManager and ThemeManager
|
||||
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({
|
||||
header:
|
||||
`${(PluginManager.errors.length && ThemeManager.errors.length ? '' :
|
||||
`${PluginManager.errors.length ? PluginManager.moduleName : ThemeManager.moduleName } - `) +
|
||||
(PluginManager.errors.length ? `${PluginManager.errors.length} ${PluginManager.contentType}${PluginManager.errors.length !== 1 ? 's' : ''}` : '') +
|
||||
(PluginManager.errors.length && ThemeManager.errors.length ? ' and ' : '') +
|
||||
(ThemeManager.errors.length ? `${ThemeManager.errors.length} ${ThemeManager.contentType}${ThemeManager.errors.length !== 1 ? 's' : ''}` : '')
|
||||
} failed to load`,
|
||||
module: (PluginManager.errors.length && ThemeManager.errors.length ? 'Content Manager' :
|
||||
(PluginManager.errors.length ? PluginManager.moduleName : ThemeManager.moduleName)),
|
||||
header: `
|
||||
${bothErr ? '' : pmErrCount ? PluginManager.moduleName : ThemeManager.moduleName} -
|
||||
${pmErrCount ? `${pmErrCount} ${PluginManager.contentType}${pmErrCount !== 1 ? 's' : ''}` : ''}
|
||||
${pmErrCount && tmErrCount ? ' and ' : ''}
|
||||
${tmErrCount ? `${tmErrCount} ${ThemeManager.contentType}${tmErrCount !== 1 ? 's' : ''}` : ''} failed to load
|
||||
`,
|
||||
module: bothErr ? 'Content Manager' : pmErrCount ? PluginManager.moduleName : ThemeManager.moduleName,
|
||||
type: 'err',
|
||||
content: errors
|
||||
});
|
||||
|
@ -254,7 +257,6 @@ export default class Modals {
|
|||
|
||||
return modal;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new settings modal and adds it to the open stack.
|
||||
|
|
Loading…
Reference in New Issue