sou 7 лет назад
Родитель
Сommit
984d75a638
3 измененных файлов с 5 добавлено и 7 удалено
  1. 1 1
      lib/routes/index.js
  2. 3 5
      lib/routes/page.js
  3. 1 1
      lib/views/modal/create_page.html

+ 1 - 1
lib/routes/index.js

@@ -167,6 +167,7 @@ module.exports = function(crowi, app) {
   app.post('/_api/pages.revertRemove' , loginRequired(crowi, app) , csrf, page.api.revertRemove); // (Avoid from API Token)
   app.post('/_api/pages.unlink'       , loginRequired(crowi, app) , csrf, page.api.unlink); // (Avoid from API Token)
   app.post('/_api/pages.duplicate'    , accessTokenParser, loginRequired(crowi, app), csrf, page.api.duplicate);
+  app.get('/_api/pages.templates'   , accessTokenParser , loginRequired(crowi, app, false) , page.api.templates);
   app.get('/_api/comments.get'        , accessTokenParser , loginRequired(crowi, app, false) , comment.api.get);
   app.post('/_api/comments.add'       , form.comment, accessTokenParser , loginRequired(crowi, app) , csrf, comment.api.add);
   app.post('/_api/comments.remove'    , accessTokenParser , loginRequired(crowi, app) , csrf, comment.api.remove);
@@ -178,7 +179,6 @@ module.exports = function(crowi, app) {
   app.get( '/_api/attachments.list'   , accessTokenParser , loginRequired(crowi, app, false) , attachment.api.list);
   app.post('/_api/attachments.add'    , uploads.single('file'), accessTokenParser, loginRequired(crowi, app) ,csrf, attachment.api.add);
   app.post('/_api/attachments.remove' , accessTokenParser , loginRequired(crowi, app) , csrf, attachment.api.remove);
-  app.get('/_api/page.template'   , accessTokenParser , loginRequired(crowi, app, false) , page.api.template);
 
   app.get( '/_api/revisions.get'      , accessTokenParser , loginRequired(crowi, app, false) , revision.api.get);
   app.get( '/_api/revisions.ids'      , accessTokenParser , loginRequired(crowi, app, false) , revision.api.ids);

+ 3 - 5
lib/routes/page.js

@@ -1173,15 +1173,13 @@ module.exports = function(crowi, app) {
   };
 
   /**
-   * @api {get} /pages.get Get page data
-   * @apiName GetPage
+   * @api {get} /pages.templates Check if templates exist for page
+   * @apiName FindTemplates
    * @apiGroup Page
    *
-   * @apiParam {String} page_id
    * @apiParam {String} path
-   * @apiParam {String} revision_id
    */
-  api.template = function(req, res) {
+  api.templates = function(req, res) {
     const pagePath = req.query.path || null;
 
     if (!pagePath) {

+ 1 - 1
lib/views/modal/create_page.html

@@ -81,7 +81,7 @@
     pagePath = pagePath.slice(0, -1);
   };
 
-  $.get(`/_api/page.template?path=${pagePath}`)
+  $.get(`/_api/pages.templates?path=${pagePath}`)
   .then(templateInfo => {
     buttonTextChildren = templateInfo.childrenTemplateExists ? '{{ t('Edit') }}' : '{{ t('Create') }}';
     buttonTextDecendants = templateInfo.decendantsTemplateExists ? '{{ t('Edit') }}' : '{{ t('Create') }}';