|
|
@@ -246,7 +246,7 @@ module.exports = function(crowi, app) {
|
|
|
var pageTeamplate = 'customlayout-selector/page';
|
|
|
|
|
|
var isRedirect = false;
|
|
|
- var originalUrl = path;
|
|
|
+ var originalPath = path;
|
|
|
Page.findPage(path, req.user, req.query.revision)
|
|
|
.then(function(page) {
|
|
|
debug('Page found', page._id, page.path);
|
|
|
@@ -311,12 +311,12 @@ module.exports = function(crowi, app) {
|
|
|
.catch(function(err) {
|
|
|
pageTeamplate = 'customlayout-selector/not_found';
|
|
|
|
|
|
- const templateUrl = cutOffLastSlash(originalUrl);
|
|
|
- const pathList = findAllAscendantPaths(originalUrl, []);
|
|
|
+ const templatePath = cutOffLastSlash(originalPath);
|
|
|
+ const pathList = findAllAscendantPaths(originalPath, []);
|
|
|
|
|
|
return Page.findAllTemplates(pathList)
|
|
|
.then(templates => {
|
|
|
- renderVars.template = templateFinder(templates, templateUrl);
|
|
|
+ renderVars.template = templateFinder(templates, templatePath);
|
|
|
});
|
|
|
})
|
|
|
// get list pages
|
|
|
@@ -405,16 +405,16 @@ module.exports = function(crowi, app) {
|
|
|
return globalTemplateFinder(globalTemplates, newPath);
|
|
|
};
|
|
|
|
|
|
- const templateFinder = (templates, templateUrl) => {
|
|
|
+ const templateFinder = (templates, templatePath) => {
|
|
|
let templateBody;
|
|
|
|
|
|
//get local template
|
|
|
//@tempate: applicable only to immediate decendants
|
|
|
- const localTemplate = findTemplateByType(templates, templateUrl, '@');
|
|
|
+ const localTemplate = findTemplateByType(templates, templatePath, '@');
|
|
|
|
|
|
//get global templates
|
|
|
//_tempate: applicable to all pages under
|
|
|
- const globalTemplate = globalTemplateFinder(templates, templateUrl);
|
|
|
+ const globalTemplate = globalTemplateFinder(templates, templatePath);
|
|
|
|
|
|
if (localTemplate) {
|
|
|
templateBody = localTemplate.revision.body;
|