|
|
@@ -531,7 +531,7 @@ module.exports = function(crowi) {
|
|
|
pageSchema.statics.checkIfTemplatesExist = function(path) {
|
|
|
const Page = this;
|
|
|
const pathList = generatePathsOnTree(path, []);
|
|
|
- const regexpList = pathList.map(path => new RegExp(`${path}/[_@]template`));
|
|
|
+ const regexpList = pathList.map(path => new RegExp(`${path}/_{1,2}template`));
|
|
|
let templateInfo = {
|
|
|
localTemplateExists: false,
|
|
|
globalTemplateExists: false,
|
|
|
@@ -540,19 +540,21 @@ module.exports = function(crowi) {
|
|
|
return Page
|
|
|
.find({path: {$in: regexpList}})
|
|
|
.then(templates => {
|
|
|
- templateInfo.localTemplateExists = (assignTemplateByType(templates, path, '@') ? true : false);
|
|
|
+ templateInfo.localTemplateExists = (assignTemplateByType(templates, path, '__') ? true : false);
|
|
|
templateInfo.globalTemplateExists = (assignGlobalTemplate(templates, path) ? true : false);
|
|
|
|
|
|
return templateInfo;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- // find all templates applicable to the new page
|
|
|
+ /**
|
|
|
+ * find all templates applicable to the new page
|
|
|
+ */
|
|
|
pageSchema.statics.findTemplate = function(path) {
|
|
|
const Page = this;
|
|
|
const templatePath = cutOffLastSlash(path);
|
|
|
const pathList = generatePathsOnTree(templatePath, []);
|
|
|
- const regexpList = pathList.map(path => new RegExp(`${path}/[_@]template`));
|
|
|
+ const regexpList = pathList.map(path => new RegExp(`${path}/_{1,2}template`));
|
|
|
|
|
|
return Page
|
|
|
.find({path: {$in: regexpList}})
|
|
|
@@ -605,7 +607,7 @@ module.exports = function(crowi) {
|
|
|
* get local template
|
|
|
* @tempate: applicable only to immediate decendants
|
|
|
*/
|
|
|
- const localTemplate = assignTemplateByType(templates, templatePath, '@');
|
|
|
+ const localTemplate = assignTemplateByType(templates, templatePath, '__');
|
|
|
|
|
|
/**
|
|
|
* get global templates
|