Просмотр исходного кода

create/edit button text for crowi

sou 7 лет назад
Родитель
Сommit
9900f160b2
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      lib/routes/page.js

+ 8 - 0
lib/routes/page.js

@@ -472,6 +472,8 @@ module.exports = function(crowi, app) {
       page: pageData,
       revision: pageData.revision || {},
       author: pageData.revision.author || false,
+      localTemplateExists: false,
+      globalTemplateExists: false,
     };
     var userPage = isUserPage(pageData.path);
     var userData = null;
@@ -509,6 +511,12 @@ module.exports = function(crowi, app) {
       }
     }).then(function() {
       return interceptorManager.process('beforeRenderPage', req, res, renderVars);
+    }).then(function() {
+      return Page.checkIfTemplatesExist(pageData.path)
+        .then(function(templateInfo) {
+          renderVars.localTemplateExists = templateInfo.localTemplateExists;
+          renderVars.globalTemplateExists = templateInfo.globalTemplateExists;
+        });
     }).then(function() {
       var defaultPageTeamplate = 'customlayout-selector/page';
       if (userData) {