yusuketk 7 лет назад
Родитель
Сommit
ec1acea05b

+ 6 - 8
src/client/js/legacy/crowi.js

@@ -355,13 +355,12 @@ $(function() {
   });
   });
   $('#renamePageForm, #unportalize-form').submit(function(e) {
   $('#renamePageForm, #unportalize-form').submit(function(e) {
     // create name-value map
     // create name-value map
-    let newPagePath = $('input', this).val();
     let nameValueMap = {};
     let nameValueMap = {};
     $(this).serializeArray().forEach((obj) => {
     $(this).serializeArray().forEach((obj) => {
-      nameValueMap[obj.name] = obj.value;
+      nameValueMap[obj.name] = obj.value; // nameValueMap['q'] is renamed page path
     });
     });
 
 
-    const data = $(this).serialize() + `&new_path=${newPagePath}&socketClientId=${crowi.getSocketClientId()}`;
+    const data = $(this).serialize() + `&socketClientId=${crowi.getSocketClientId()}`;
 
 
     $.ajax({
     $.ajax({
       type: 'POST',
       type: 'POST',
@@ -375,7 +374,7 @@ $(function() {
         $('#renamePage .msg, #unportalize .msg').hide();
         $('#renamePage .msg, #unportalize .msg').hide();
         $(`#renamePage .msg-${res.code}, #unportalize .msg-${res.code}`).show();
         $(`#renamePage .msg-${res.code}, #unportalize .msg-${res.code}`).show();
         $('#renamePage #linkToNewPage, #unportalize #linkToNewPage').html(`
         $('#renamePage #linkToNewPage, #unportalize #linkToNewPage').html(`
-          <a href="${nameValueMap.new_path}">${nameValueMap.new_path} <i class="icon-login"></i></a>
+          <a href="${nameValueMap.q}">${nameValueMap.q} <i class="icon-login"></i></a>
         `);
         `);
       }
       }
       else {
       else {
@@ -394,16 +393,15 @@ $(function() {
   });
   });
   $('#duplicatePageForm, #unportalize-form').submit(function(e) {
   $('#duplicatePageForm, #unportalize-form').submit(function(e) {
     // create name-value map
     // create name-value map
-    let newPagePath = $('input', this).val();
     let nameValueMap = {};
     let nameValueMap = {};
     $(this).serializeArray().forEach((obj) => {
     $(this).serializeArray().forEach((obj) => {
-      nameValueMap[obj.name] = obj.value;
+      nameValueMap[obj.name] = obj.value; // nameValueMap['q'] is duplicated page path
     });
     });
 
 
     $.ajax({
     $.ajax({
       type: 'POST',
       type: 'POST',
       url: '/_api/pages.duplicate',
       url: '/_api/pages.duplicate',
-      data: $(this).serialize() + `&new_path=${newPagePath}`,
+      data: $(this).serialize(),
       dataType: 'json'
       dataType: 'json'
     }).done(function(res) {
     }).done(function(res) {
       // error
       // error
@@ -411,7 +409,7 @@ $(function() {
         $('#duplicatePage .msg').hide();
         $('#duplicatePage .msg').hide();
         $(`#duplicatePage .msg-${res.code}`).show();
         $(`#duplicatePage .msg-${res.code}`).show();
         $('#duplicatePage #linkToNewPage').html(`
         $('#duplicatePage #linkToNewPage').html(`
-          <a href="${nameValueMap.new_path}">${nameValueMap.new_path} <i class="icon-login"></i></a>
+          <a href="${nameValueMap.q}">${nameValueMap.q} <i class="icon-login"></i></a>
         `);
         `);
       }
       }
       else {
       else {

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

@@ -951,13 +951,13 @@ module.exports = function(crowi, app) {
    * @apiParam {String} page_id Page Id.
    * @apiParam {String} page_id Page Id.
    * @apiParam {String} path
    * @apiParam {String} path
    * @apiParam {String} revision_id
    * @apiParam {String} revision_id
-   * @apiParam {String} new_path
+   * @apiParam {String} q New path name.
    * @apiParam {Bool} create_redirect
    * @apiParam {Bool} create_redirect
    */
    */
   api.rename = async function(req, res) {
   api.rename = async function(req, res) {
     const pageId = req.body.page_id;
     const pageId = req.body.page_id;
     const previousRevision = req.body.revision_id || null;
     const previousRevision = req.body.revision_id || null;
-    const newPagePath = Page.normalizePath(req.body.new_path);
+    const newPagePath = Page.normalizePath(req.body.q);
     const options = {
     const options = {
       createRedirectPage: req.body.create_redirect || 0,
       createRedirectPage: req.body.create_redirect || 0,
       moveUnderTrees: req.body.move_trees || 0,
       moveUnderTrees: req.body.move_trees || 0,
@@ -1017,11 +1017,11 @@ module.exports = function(crowi, app) {
    * @apiGroup Page
    * @apiGroup Page
    *
    *
    * @apiParam {String} page_id Page Id.
    * @apiParam {String} page_id Page Id.
-   * @apiParam {String} new_path
+   * @apiParam {String} q New path name.
    */
    */
   api.duplicate = async function(req, res) {
   api.duplicate = async function(req, res) {
     const pageId = req.body.page_id;
     const pageId = req.body.page_id;
-    const newPagePath = Page.normalizePath(req.body.new_path);
+    const newPagePath = Page.normalizePath(req.body.q);
 
 
     const page = await Page.findByIdAndViewer(pageId, req.user);
     const page = await Page.findByIdAndViewer(pageId, req.user);
 
 

+ 1 - 1
src/server/views/modal/duplicate.html

@@ -20,7 +20,7 @@
                 {% if searchConfigured() %}
                 {% if searchConfigured() %}
                 <div id="duplicate-page-name-input" class="page-name-input"></div>
                 <div id="duplicate-page-name-input" class="page-name-input"></div>
                 {% else %}
                 {% else %}
-                <input type="text" class="form-control" name="new_path" id="duplicatePageName" value="{{ page.path }}">
+                <input type="text" class="form-control" name="q" id="duplicatePageName" value="{{ page.path }}">
                 {% endif %}
                 {% endif %}
               </div>
               </div>
             </div>
             </div>

+ 1 - 1
src/server/views/modal/rename.html

@@ -20,7 +20,7 @@
               {% if searchConfigured() %}
               {% if searchConfigured() %}
               <div id="rename-page-name-input" class="page-name-input"></div>
               <div id="rename-page-name-input" class="page-name-input"></div>
               {% else %}
               {% else %}
-              <input type="text" class="form-control" name="new_path" id="newPageName" value="{{ page.path }}">
+              <input type="text" class="form-control" name="q" id="newPageName" value="{{ page.path }}">
               {% endif %}
               {% endif %}
             </div>
             </div>
           </div>
           </div>

+ 1 - 1
src/server/views/modal/unportalize.html

@@ -37,7 +37,7 @@
             <div>
             <div>
               <input type="hidden" name="_csrf" value="{{ csrf() }}">
               <input type="hidden" name="_csrf" value="{{ csrf() }}">
               <input type="hidden" name="path" value="{{ page.path }}">
               <input type="hidden" name="path" value="{{ page.path }}">
-              <input type="hidden" class="form-control" name="new_path" id="newPageName" value="{{ unportalizedPath }}">
+              <input type="hidden" class="form-control" name="q" id="newPageName" value="{{ unportalizedPath }}">
               <input type="hidden" name="page_id" value="{{ page._id.toString() }}">
               <input type="hidden" name="page_id" value="{{ page._id.toString() }}">
               <input type="hidden" name="revision_id" value="{{ page.revision._id.toString() }}">
               <input type="hidden" name="revision_id" value="{{ page.revision._id.toString() }}">
               <button type="submit" class="btn btn-warning">Unportalize</button>
               <button type="submit" class="btn btn-warning">Unportalize</button>