|
|
@@ -82,6 +82,15 @@ module.exports = function(crowi) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function getValueForCrowiNS(config, key) {
|
|
|
+ // return the default value if undefined
|
|
|
+ if (undefined === config.crowi || undefined === config.crowi[key]) {
|
|
|
+ return getDefaultCrowiConfigs()[key];
|
|
|
+ }
|
|
|
+
|
|
|
+ return config.crowi[key];
|
|
|
+ }
|
|
|
+
|
|
|
configSchema.statics.getRestrictGuestModeLabels = function()
|
|
|
{
|
|
|
var labels = {};
|
|
|
@@ -250,38 +259,32 @@ module.exports = function(crowi) {
|
|
|
|
|
|
configSchema.statics.isEnabledPlugins = function(config)
|
|
|
{
|
|
|
- var defaultValue = getDefaultCrowiConfigs()['plugin:isEnabledPlugins'];
|
|
|
-
|
|
|
- // return defaultValue if undefined
|
|
|
- if (undefined === config.crowi || undefined === config.crowi['plugin:isEnabledPlugins']) {
|
|
|
- return defaultValue;
|
|
|
- }
|
|
|
-
|
|
|
- return config.crowi['plugin:isEnabledPlugins'];
|
|
|
+ const key = 'plugin:isEnabledPlugins';
|
|
|
+ return getValueForCrowiNS(config, key);
|
|
|
};
|
|
|
|
|
|
configSchema.statics.isEnabledLinebreaks = function(config)
|
|
|
{
|
|
|
- var defaultValue = getDefaultMarkdownConfigs()['markdown:isEnabledLinebreaks'];
|
|
|
+ const key = 'markdown:isEnabledLinebreaks';
|
|
|
|
|
|
- // return defaultValue if undefined
|
|
|
- if (undefined === config.markdown || undefined === config.markdown['markdown:isEnabledLinebreaks']) {
|
|
|
- return defaultValue;
|
|
|
+ // return default value if undefined
|
|
|
+ if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
+ return getDefaultMarkdownConfigs[key];
|
|
|
}
|
|
|
|
|
|
- return config.markdown['markdown:isEnabledLinebreaks'];
|
|
|
+ return config.markdown[key];
|
|
|
};
|
|
|
|
|
|
configSchema.statics.isEnabledLinebreaksInComments = function(config)
|
|
|
{
|
|
|
- var defaultValue = getDefaultMarkdownConfigs()['markdown:isEnabledLinebreaksInComments'];
|
|
|
+ const key = 'markdown:isEnabledLinebreaksInComments';
|
|
|
|
|
|
- // return defaultValue if undefined
|
|
|
- if (undefined === config.markdown || undefined === config.markdown['markdown:isEnabledLinebreaksInComments']) {
|
|
|
- return defaultValue;
|
|
|
+ // return default value if undefined
|
|
|
+ if (undefined === config.markdown || undefined === config.markdown[key]) {
|
|
|
+ return getDefaultMarkdownConfigs[key];
|
|
|
}
|
|
|
|
|
|
- return config.markdown['markdown:isEnabledLinebreaksInComments'];
|
|
|
+ return config.markdown[key];
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -289,7 +292,8 @@ module.exports = function(crowi) {
|
|
|
*/
|
|
|
configSchema.statics.generateUglifiedCustomCss = function(config)
|
|
|
{
|
|
|
- var rawCss = config.crowi['customize:css'] || getDefaultCrowiConfigs()['customize:css'];
|
|
|
+ const key = 'customize:css';
|
|
|
+ const rawCss = getValueForCrowiNS(config, key);
|
|
|
this.uglifiedCustomCss = uglifycss.processString(rawCss);
|
|
|
}
|
|
|
|
|
|
@@ -300,36 +304,26 @@ module.exports = function(crowi) {
|
|
|
|
|
|
configSchema.statics.behaviorType = function(config)
|
|
|
{
|
|
|
- return config.crowi['customize:behavior'] || 'crowi';
|
|
|
+ const key = 'customize:behavior';
|
|
|
+ return getValueForCrowiNS(config, key);
|
|
|
}
|
|
|
|
|
|
configSchema.statics.layoutType = function(config)
|
|
|
{
|
|
|
- return config.crowi['customize:layout'] || 'crowi';
|
|
|
+ const key = 'customize:layout';
|
|
|
+ return getValueForCrowiNS(config, key);
|
|
|
}
|
|
|
|
|
|
configSchema.statics.isEnabledTimeline = function(config)
|
|
|
{
|
|
|
- var defaultValue = getDefaultCrowiConfigs()['customize:isEnabledTimeline'];
|
|
|
-
|
|
|
- // return defaultValue if undefined
|
|
|
- if (undefined === config.crowi || undefined === config.crowi['customize:isEnabledTimeline']) {
|
|
|
- return defaultValue;
|
|
|
- }
|
|
|
-
|
|
|
- return config.crowi['customize:isEnabledTimeline'];
|
|
|
+ const key = 'customize:isEnabledTimeline';
|
|
|
+ return getValueForCrowiNS(config, key);
|
|
|
};
|
|
|
|
|
|
configSchema.statics.isSavedStatesOfTabChanges = function(config)
|
|
|
{
|
|
|
const key = 'customize:isSavedStatesOfTabChanges';
|
|
|
-
|
|
|
- // return the default value if undefined
|
|
|
- if (undefined === config.crowi || undefined === config.crowi[key]) {
|
|
|
- return getDefaultCrowiConfigs()[key];
|
|
|
- }
|
|
|
-
|
|
|
- return config.crowi[key];
|
|
|
+ return getValueForCrowiNS(config, key);
|
|
|
};
|
|
|
|
|
|
configSchema.statics.fileUploadEnabled = function(config)
|