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

Merge pull request #2990 from weseek/feat/gw-4164

feat/gw-4164
takeru0001 5 лет назад
Родитель
Сommit
e5d1ffd457

+ 4 - 1
resource/locales/en_US/translation.json

@@ -342,9 +342,12 @@
       "New page name": "New page name",
       "New page name": "New page name",
       "Fail to get subordinated pages": "Fail to get subordinated pages",
       "Fail to get subordinated pages": "Fail to get subordinated pages",
       "Current page name": "Current page name",
       "Current page name": "Current page name",
-      "Duplicate with child": "Duplicate with child",
+      "Recursively": "Recursively",
       "Duplicate without exist path": "Duplicate without exist path",
       "Duplicate without exist path": "Duplicate without exist path",
       "Same page already exists": "Same page already exists"
       "Same page already exists": "Same page already exists"
+    },
+    "help": {
+      "recursive": "Duplicate children of under this path recursively"
     }
     }
   },
   },
   "modal_putback": {
   "modal_putback": {

+ 4 - 1
resource/locales/ja_JP/translation.json

@@ -344,9 +344,12 @@
       "New page name": "複製後のページ名",
       "New page name": "複製後のページ名",
       "Fail to get subordinated pages": "配下ページの取得に失敗しました",
       "Fail to get subordinated pages": "配下ページの取得に失敗しました",
       "Current page name": "現在のページ名",
       "Current page name": "現在のページ名",
-      "Duplicate with child": "配下のページも一緒に複製する",
+      "Recursively": "再帰的に複製",
       "Duplicate without exist path": "存在するパス以外を複製する",
       "Duplicate without exist path": "存在するパス以外を複製する",
       "Same page already exists": "同じページがすでに存在します"
       "Same page already exists": "同じページがすでに存在します"
+    },
+    "help": {
+      "recursive": "配下のページも複製します"
     }
     }
   },
   },
   "modal_putback": {
   "modal_putback": {

+ 5 - 2
resource/locales/zh_CN/translation.json

@@ -322,10 +322,13 @@
       "New page name": "New page name",
       "New page name": "New page name",
       "Fail to get subordinated pages": "Fail to get subordinated pages",
       "Fail to get subordinated pages": "Fail to get subordinated pages",
 			"Current page name": "Current page name",
 			"Current page name": "Current page name",
-      "Duplicate with child": "Duplicate with child",
+      "Recursively": "Recursively",
       "Duplicate without exist path": "Duplicate without exist path",
       "Duplicate without exist path": "Duplicate without exist path",
       "Same page already exists": "Same page already exists"
       "Same page already exists": "Same page already exists"
-		}
+    },
+    "help": {
+      "recursive": "Duplicate children of under this path recursively"
+    }
 	},
 	},
 	"modal_putback": {
 	"modal_putback": {
 		"label": {
 		"label": {

+ 28 - 23
src/client/js/components/PageDuplicateModal.jsx

@@ -32,9 +32,8 @@ const PageDuplicateModal = (props) => {
   const [errs, setErrs] = useState(null);
   const [errs, setErrs] = useState(null);
 
 
   const [subordinatedPages, setSubordinatedPages] = useState([]);
   const [subordinatedPages, setSubordinatedPages] = useState([]);
-  const [isDuplicateRecursively, setIsDuplicateRecursively] = useState(false);
-  const [isDuplicateRecursivelyWithoutExistPath, setIsDuplicateRecursivelyWithoutExistPath] = useState(false);
-  const [isDuplicateRecursivelyExist] = useState(false);
+  const [isDuplicateRecursively, setIsDuplicateRecursively] = useState(true);
+  const [isDuplicateRecursivelyWithoutExistPath, setIsDuplicateRecursivelyWithoutExistPath] = useState(true);
   const [existingPaths, setExistingPaths] = useState([]);
   const [existingPaths, setExistingPaths] = useState([]);
 
 
   const checkExistPaths = async(newParentPath) => {
   const checkExistPaths = async(newParentPath) => {
@@ -166,27 +165,33 @@ const PageDuplicateModal = (props) => {
             onChange={changeIsDuplicateRecursivelyHandler}
             onChange={changeIsDuplicateRecursivelyHandler}
           />
           />
           <label className="custom-control-label" htmlFor="cbDuplicateRecursively">
           <label className="custom-control-label" htmlFor="cbDuplicateRecursively">
-            { t('modal_duplicate.label.Duplicate with child') }
+            { t('modal_duplicate.label.Recursively') }
+            <p className="form-text text-muted mt-0">{ t('modal_duplicate.help.recursive') }</p>
           </label>
           </label>
-        </div>
-        {isDuplicateRecursively && <ComparePathsTable subordinatedPages={subordinatedPages} newPagePath={pageNameInput} />}
-        {isDuplicateRecursively && existingPaths.length !== 0 && <DuplicatePathsTable existingPaths={existingPaths} oldPagePath={pageNameInput} />}
-
-        {isDuplicateRecursively && (
-          <div className="custom-control custom-checkbox custom-checkbox-warning">
-            <input
-              className="custom-control-input"
-              name="withoutExistRecursively"
-              id="cbDuplicatewithoutExistRecursively"
-              type="checkbox"
-              checked={isDuplicateRecursivelyWithoutExistPath}
-              onChange={changeIsDuplicateRecursivelyWithoutExistPathHandler}
-            />
-            <label className="custom-control-label" htmlFor="cbDuplicatewithoutExistRecursively">
-              { t('modal_duplicate.label.Duplicate without exist path') }
-            </label>
+
+          <div>
+            {isDuplicateRecursively && existingPaths.length !== 0 && (
+            <div className="custom-control custom-checkbox custom-checkbox-warning">
+              <input
+                className="custom-control-input"
+                name="withoutExistRecursively"
+                id="cbDuplicatewithoutExistRecursively"
+                type="checkbox"
+                checked={isDuplicateRecursivelyWithoutExistPath}
+                onChange={changeIsDuplicateRecursivelyWithoutExistPathHandler}
+              />
+              <label className="custom-control-label" htmlFor="cbDuplicatewithoutExistRecursively">
+                { t('modal_duplicate.label.Duplicate without exist path') }
+              </label>
+            </div>
+            )}
           </div>
           </div>
-        )}
+          <div>
+            {isDuplicateRecursively && <ComparePathsTable subordinatedPages={subordinatedPages} newPagePath={pageNameInput} />}
+            {isDuplicateRecursively && existingPaths.length !== 0 && <DuplicatePathsTable existingPaths={existingPaths} oldPagePath={pageNameInput} />}
+          </div>
+        </div>
+
       </ModalBody>
       </ModalBody>
       <ModalFooter>
       <ModalFooter>
         <ApiErrorMessageList errs={errs} targetPath={pageNameInput} />
         <ApiErrorMessageList errs={errs} targetPath={pageNameInput} />
@@ -194,7 +199,7 @@ const PageDuplicateModal = (props) => {
           type="button"
           type="button"
           className="btn btn-primary"
           className="btn btn-primary"
           onClick={duplicate}
           onClick={duplicate}
-          disabled={(isDuplicateRecursively && isDuplicateRecursivelyExist && !isDuplicateRecursivelyWithoutExistPath) || (path === pageNameInput)}
+          disabled={(isDuplicateRecursively && !isDuplicateRecursivelyWithoutExistPath && existingPaths.length !== 0)}
         >
         >
           { t('modal_duplicate.label.Duplicate page') }
           { t('modal_duplicate.label.Duplicate page') }
         </button>
         </button>

+ 1 - 1
src/client/js/components/PageRenameModal.jsx

@@ -190,7 +190,7 @@ const PageRenameModal = (props) => {
               { t('modal_rename.label.Rename without exist path') }
               { t('modal_rename.label.Rename without exist path') }
             </label>
             </label>
           </div>
           </div>
-)}
+          )}
           {isRenameRecursively && <ComparePathsTable subordinatedPages={subordinatedPages} newPagePath={pageNameInput} />}
           {isRenameRecursively && <ComparePathsTable subordinatedPages={subordinatedPages} newPagePath={pageNameInput} />}
           {isRenameRecursively && existingPaths.length !== 0 && <DuplicatedPathsTable existingPaths={existingPaths} oldPagePath={pageNameInput} />}
           {isRenameRecursively && existingPaths.length !== 0 && <DuplicatedPathsTable existingPaths={existingPaths} oldPagePath={pageNameInput} />}
         </div>
         </div>