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

Display only the RevisionPath if the page is trash or forbidden

itizawa 6 лет назад
Родитель
Сommit
cea0030b03

+ 16 - 4
src/client/js/components/Navbar/GrowiSubNavigation.jsx

@@ -15,12 +15,25 @@ import PageCreator from './PageCreator';
 import RevisionAuthor from './RevisionAuthor';
 
 const GrowiSubNavigation = (props) => {
+  const isPageForbidden = document.querySelector('#grw-subnav').getAttribute('data-is-forbidden-page');
   const { appContainer, pageContainer } = props;
-  const path = pageContainer.path || '';
   const {
-    createdAt, creator, updatedAt, revisionAuthor,
+    path, createdAt, creator, updatedAt, revisionAuthor,
   } = pageContainer.state;
 
+  // Display only the RevisionPath if the page is trash or forbidden
+  if (isTrashPage(path) || isPageForbidden) {
+    return (
+      <div className="d-flex align-items-center">
+        <div className="title-container mr-auto">
+          <h1>
+            <RevisionPath behaviorType={appContainer.config.behaviorType} pageId={pageContainer.state.pageId} pagePath={pageContainer.state.path} />
+          </h1>
+        </div>
+      </div>
+    );
+  }
+
   return (
     <div className="d-flex align-items-center">
 
@@ -29,8 +42,7 @@ const GrowiSubNavigation = (props) => {
         <h1>
           <RevisionPath behaviorType={appContainer.config.behaviorType} pageId={pageContainer.state.pageId} pagePath={pageContainer.state.path} />
         </h1>
-        {/* TODO hide this component at forbidden page */}
-        {!isTrashPage(path) && <TagLabels />}
+        <TagLabels />
       </div>
 
       {/* Header Button */}

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

@@ -1,6 +1,6 @@
 <header id="page-header">
 
-  <div id="grw-subnav"></div>
+  <div id="grw-subnav" data-is-forbidden-page="{{ forbidden }}"></div>
 
     {% if not page and not forbidden and ('/' === path or 'crowi' === getConfig('crowi', 'customize:behavior')) and not isUserPageList(path) and !isTrashPage() %}
       {% if '/' === path.slice(-1) %}