|
@@ -383,52 +383,6 @@ module.exports = function(crowi, app) {
|
|
|
return generatePathsOnTree(newPath, pathList);
|
|
return generatePathsOnTree(newPath, pathList);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const assignTemplateByType = (templates, path, type) => {
|
|
|
|
|
- for (let i = 0; i < templates.length; i++) {
|
|
|
|
|
- if (templates[i].path === `${path}/${type}template`) {
|
|
|
|
|
- return templates[i];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const assignGlobalTemplate = (globalTemplates, path) => {
|
|
|
|
|
- const globalTemplate = assignTemplateByType(globalTemplates, path, '_');
|
|
|
|
|
- if (globalTemplate) {
|
|
|
|
|
- return globalTemplate;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (path === '') {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const newPath = cutOffLastSlash(path);
|
|
|
|
|
- return assignGlobalTemplate(globalTemplates, newPath);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const fetchTemplate = (templates, templatePath) => {
|
|
|
|
|
- let templateBody;
|
|
|
|
|
- /**
|
|
|
|
|
- * get local template
|
|
|
|
|
- * @tempate: applicable only to immediate decendants
|
|
|
|
|
- */
|
|
|
|
|
- const localTemplate = assignTemplateByType(templates, templatePath, '@');
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * get global templates
|
|
|
|
|
- * _tempate: applicable to all pages under
|
|
|
|
|
- */
|
|
|
|
|
- const globalTemplate = assignGlobalTemplate(templates, templatePath);
|
|
|
|
|
-
|
|
|
|
|
- if (localTemplate) {
|
|
|
|
|
- templateBody = localTemplate.revision.body;
|
|
|
|
|
- }
|
|
|
|
|
- else if (globalTemplate) {
|
|
|
|
|
- templateBody = globalTemplate.revision.body;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return templateBody;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
actions.deletedPageListShow = function(req, res) {
|
|
actions.deletedPageListShow = function(req, res) {
|
|
|
var path = '/trash' + getPathFromRequest(req);
|
|
var path = '/trash' + getPathFromRequest(req);
|
|
|
var limit = 50;
|
|
var limit = 50;
|