فهرست منبع

disabling tag function

yusuketk 7 سال پیش
والد
کامیت
04d9c059a9
4فایلهای تغییر یافته به همراه26 افزوده شده و 27 حذف شده
  1. 1 1
      src/client/js/app.js
  2. 22 23
      src/server/models/page.js
  3. 2 2
      src/server/routes/page.js
  4. 1 1
      src/server/views/layout-growi/widget/header.html

+ 1 - 1
src/client/js/app.js

@@ -307,7 +307,7 @@ if (pageId) {
 if (pagePath) {
 if (pagePath) {
   componentMappings['page'] = <Page crowi={crowi} crowiRenderer={crowiRenderer} markdown={markdown} pagePath={pagePath} showHeadEditButton={true} onSaveWithShortcut={saveWithShortcut} />;
   componentMappings['page'] = <Page crowi={crowi} crowiRenderer={crowiRenderer} markdown={markdown} pagePath={pagePath} showHeadEditButton={true} onSaveWithShortcut={saveWithShortcut} />;
   componentMappings['revision-path'] = <RevisionPath pagePath={pagePath} crowi={crowi} />;
   componentMappings['revision-path'] = <RevisionPath pagePath={pagePath} crowi={crowi} />;
-  componentMappings['page-tag'] = <PageTagForm pageTags={currentPageTags} submitTags={getNewPageTags} />;
+  // componentMappings['page-tag'] = <PageTagForm pageTags={currentPageTags} submitTags={getNewPageTags} />; [pagetag]
   componentMappings['revision-url'] = <RevisionUrl pageId={pageId} pagePath={pagePath} />;
   componentMappings['revision-url'] = <RevisionUrl pageId={pageId} pagePath={pagePath} />;
 }
 }
 
 

+ 22 - 23
src/server/models/page.js

@@ -293,15 +293,15 @@ module.exports = function(crowi) {
   };
   };
 
 
   pageSchema.methods.updateTags = async function(newTagsName) {
   pageSchema.methods.updateTags = async function(newTagsName) {
-    const page = this;
-    const PageTagRelation = mongoose.model('PageTagRelation');
-    const Tag = mongoose.model('Tag');
+    // const page = this;
+    // const PageTagRelation = mongoose.model('PageTagRelation');
+    // const Tag = mongoose.model('Tag');
 
 
-    const newTagNameList = [newTagsName]; // [TODO] listing requested Tags on client side
+    // const newTagNameList = [newTagsName]; // [TODO] listing requested Tags on client side
 
 
-    // get tags relate this page
-    const relations = await PageTagRelation.find({relatedPage: page._id}).populate('relatedTag').select('-_id relatedTag');
-    console.log(relations);
+    // // get tags relate this page
+    // const relations = await PageTagRelation.find({relatedPage: page._id}).populate('relatedTag').select('-_id relatedTag');
+    // console.log(relations);
     // // relations.populate(...)
     // // relations.populate(...)
     // // const relatedTagNameList = await Promise.all(relations.map(async function(relation) {
     // // const relatedTagNameList = await Promise.all(relations.map(async function(relation) {
     // //   const relatedTag =  await Tag.findOne({_id: relation.relatedTag});
     // //   const relatedTag =  await Tag.findOne({_id: relation.relatedTag});
@@ -342,22 +342,21 @@ module.exports = function(crowi) {
     //     setTagNameList.push(newTagName);
     //     setTagNameList.push(newTagName);
     //   }
     //   }
     // });
     // });
-// const setTagNameList = ['a', 'b', 'c'];
-//     // set tags
-//     setTagNameList.map((tagName) => {
-//       Tag.findOne({name: tagName}, async function(err, tag) {
-//         if (tag == null) {
-//           tag = await Tag.create({name: tagName});
-//         }
-//         // make a relation
-//         PageTagRelation.create({relatedPage: page._id, relatedTag: tag._id}, function(err, relation) {
-//           if (err) {
-//             throw new Error(err);
-//           }
-//           debug('tag linked this page: ', tag.name);
-//         });
-//       });
-//     });
+    // // set tags
+    // setTagNameList.map((tagName) => {
+    //   Tag.findOne({name: tagName}, async function(err, tag) {
+    //     if (tag == null) {
+    //       tag = await Tag.create({name: tagName});
+    //     }
+    //     // make a relation
+    //     PageTagRelation.create({relatedPage: page._id, relatedTag: tag._id}, function(err, relation) {
+    //       if (err) {
+    //         throw new Error(err);
+    //       }
+    //       debug('tag linked this page: ', tag.name);
+    //     });
+    //   });
+    // });
   };
   };
 
 
 
 

+ 2 - 2
src/server/routes/page.js

@@ -658,8 +658,8 @@ module.exports = function(crowi, app) {
       await notifyToSlackByUser(page, req.user, slackChannels, 'update', previousRevision);
       await notifyToSlackByUser(page, req.user, slackChannels, 'update', previousRevision);
     }
     }
 
 
-    // update page tag
-    await page.updateTags(pageTags);
+    // // update page tag
+    // await page.updateTags(pageTags); [pagetag]
   };
   };
 
 
   /**
   /**

+ 1 - 1
src/server/views/layout-growi/widget/header.html

@@ -10,7 +10,7 @@
         <h1 class="title" id="revision-path"></h1>
         <h1 class="title" id="revision-path"></h1>
         <div id="revision-url" class="url-line"></div>
         <div id="revision-url" class="url-line"></div>
       </div>
       </div>
-      <div class="tag" id="page-tag"></div>
+      <!-- <div class="tag" id="page-tag"></div> [pagetag]-->
       {% if page %}
       {% if page %}
       {% include '../../widget/header-buttons.html' %}
       {% include '../../widget/header-buttons.html' %}