Explorar o código

add current path

itizawa %!s(int64=5) %!d(string=hai) anos
pai
achega
77b04be071

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

@@ -79,7 +79,7 @@ const PageDuplicateModal = (props) => {
         </div>
       </ModalBody>
       <ModalFooter>
-        <ApiErrorMessage errorMessage={errorMessage} />
+        <ApiErrorMessage errorMessage={errorMessage} linkPath={path} />
         <button type="button" className="btn btn-primary" onClick={clickDuplicateButtonHandler}>Duplicate page</button>
       </ModalFooter>
     </Modal>

+ 6 - 5
src/client/js/components/PageManagement/ApiErrorMessage.jsx

@@ -4,15 +4,15 @@ import PropTypes from 'prop-types';
 import { withTranslation } from 'react-i18next';
 
 const ApiErrorMessage = (props) => {
-  const { t, errorMessage } = props;
+  const { t, errorMessage, linkPath } = props;
 
   function renderMessage() {
     switch (errorMessage) {
       case 'Page exists':
         return (
           <span className="text-danger msg msg-already_exists">
-            <strong><i className="icon-fw icon-ban"></i>{ t('page_api_error.already_exists') }</strong><br />
-            <small id="linkToNewPage"></small>
+            <strong><i className="icon-fw icon-ban"></i>{ t('page_api_error.already_exists') }</strong>
+            <small id="linkToNewPage"><a href={linkPath}>{linkPath} <i className="icon-login"></i></a></small>
           </span>
         );
       default:
@@ -21,9 +21,9 @@ const ApiErrorMessage = (props) => {
   }
 
   return (
-    <div>
+    <>
       {renderMessage()}
-    </div>
+    </>
   );
 
   // TODO Set according to error message
@@ -53,6 +53,7 @@ const ApiErrorMessage = (props) => {
 ApiErrorMessage.propTypes = {
   t: PropTypes.func.isRequired, //  i18next
   errorMessage: PropTypes.string,
+  linkPath: PropTypes.string,
 };
 
 export default withTranslation()(ApiErrorMessage);