|
|
@@ -331,13 +331,7 @@ module.exports = function(crowi, app) {
|
|
|
return Page.findTemplate(path)
|
|
|
.then(template => {
|
|
|
if (template) {
|
|
|
- const definitions = {
|
|
|
- pagepath: path,
|
|
|
- username: req.user.name,
|
|
|
- today: getToday(),
|
|
|
- };
|
|
|
-
|
|
|
- template = placeholderReader(template, definitions);
|
|
|
+ template = replacePlaceholders(template, req);
|
|
|
}
|
|
|
|
|
|
renderVars.template = template;
|
|
|
@@ -376,8 +370,14 @@ module.exports = function(crowi, app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- const placeholderReader = (template, definitions) => {
|
|
|
+ const replacePlaceholders = (template, req) => {
|
|
|
+ const definitions = {
|
|
|
+ pagepath: getPathFromRequest(req),
|
|
|
+ username: req.user.name,
|
|
|
+ today: getToday(),
|
|
|
+ };
|
|
|
const compiledTemplate = swig.compile(template);
|
|
|
+
|
|
|
return compiledTemplate(definitions);
|
|
|
};
|
|
|
|
|
|
@@ -457,13 +457,7 @@ module.exports = function(crowi, app) {
|
|
|
return Page.findTemplate(path)
|
|
|
.then(template => {
|
|
|
if (template) {
|
|
|
- const definitions = {
|
|
|
- pagepath: path,
|
|
|
- username: req.user.name,
|
|
|
- today: getToday(),
|
|
|
- };
|
|
|
-
|
|
|
- template = placeholderReader(template, definitions);
|
|
|
+ template = replacePlaceholders(template, req);
|
|
|
}
|
|
|
|
|
|
return res.render('customlayout-selector/not_found', {
|