Browse Source

[https://github.com/tracim/tracim/issues/787] moved admin link into specific dropdown

Skylsmoi 6 years ago
parent
commit
2f8f2837fa

+ 29 - 0
frontend/src/component/Header/MenuActionListItem/AdminLink.jsx View File

@@ -0,0 +1,29 @@
1
+import React from 'react'
2
+import { Link } from 'react-router-dom'
3
+import { PAGE } from '../../../helper.js'
4
+
5
+const AdminLink = props => {
6
+  return (
7
+    <li className='header__menu__rightside__adminlink'>
8
+      <div className='adminlink dropdown'>
9
+        <button className='adminlink__btn btn dropdown-toggle' type='button' data-toggle='dropdown'>
10
+          Administration
11
+        </button>
12
+
13
+        <div className='adminlink__setting dropdown-menu' aria-labelledby='dropdownMenuButton'>
14
+          <Link className='setting__link dropdown-item' to={PAGE.ADMIN.WORKSPACE}>
15
+            <i className='fa fa-fw fa-space-shuttle mr-2' />
16
+            {props.t('Admin workspace')}
17
+          </Link>
18
+
19
+          <Link className='setting__link dropdown-item' to={PAGE.ADMIN.USER}>
20
+            <i className='fa fa-fw fa-users mr-2' />
21
+            {props.t('Admin user')}
22
+          </Link>
23
+        </div>
24
+      </div>
25
+    </li>
26
+  )
27
+}
28
+
29
+export default AdminLink

+ 4 - 18
frontend/src/component/Header/MenuActionListItem/MenuProfil.jsx View File

@@ -1,12 +1,13 @@
1 1
 import React from 'react'
2 2
 import { Link } from 'react-router-dom'
3 3
 import PropTypes from 'prop-types'
4
-import { PAGE, PROFILE } from '../../../helper.js'
4
+import { PAGE } from '../../../helper.js'
5 5
 import { translate } from 'react-i18next'
6 6
 
7 7
 const MenuProfil = props => {
8
-  return props.user.logged
9
-    ? (
8
+  if (!props.user.logged) return null
9
+
10
+  return (
10 11
       <li className='header__menu__rightside__itemprofil'>
11 12
         <div className='profilgroup dropdown'>
12 13
           <button className='profilgroup__name btn btn-outline-primary dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
@@ -18,20 +19,6 @@ const MenuProfil = props => {
18 19
           </button>
19 20
 
20 21
           <div className='profilgroup__setting dropdown-menu' aria-labelledby='dropdownMenuButton'>
21
-            {props.user.profile === PROFILE.ADMINISTRATOR &&
22
-              <Link className='setting__link dropdown-item' to={PAGE.ADMIN.WORKSPACE}>
23
-                <i className='fa fa-fw fa-space-shuttle mr-2' />
24
-                {props.t('Admin workspace')}
25
-              </Link>
26
-            }
27
-
28
-            {props.user.profile === PROFILE.ADMINISTRATOR &&
29
-              <Link className='setting__link dropdown-item' to={PAGE.ADMIN.USER}>
30
-                <i className='fa fa-fw fa-users mr-2' />
31
-                {props.t('Admin user')}
32
-              </Link>
33
-            }
34
-
35 22
             <Link className='setting__link dropdown-item' to={PAGE.ACCOUNT}>
36 23
               <i className='fa fa-fw fa-user-o mr-2' />
37 24
               {props.t('My Account')}
@@ -46,7 +33,6 @@ const MenuProfil = props => {
46 33
         </div>
47 34
       </li>
48 35
     )
49
-    : ''
50 36
 }
51 37
 export default translate()(MenuProfil)
52 38
 

+ 6 - 1
frontend/src/container/Header.jsx View File

@@ -13,6 +13,7 @@ import MenuActionListItemDropdownLang from '../component/Header/MenuActionListIt
13 13
 import MenuActionListItemHelp from '../component/Header/MenuActionListItem/Help.jsx'
14 14
 import MenuActionListItemMenuProfil from '../component/Header/MenuActionListItem/MenuProfil.jsx'
15 15
 import MenuActionListItemNotification from '../component/Header/MenuActionListItem/Notification.jsx'
16
+import MenuActionListAdminLink from '../component/Header/MenuActionListItem/AdminLink.jsx'
16 17
 import logoHeader from '../img/logo-tracim.png'
17 18
 import {
18 19
   newFlashMessage,
@@ -22,7 +23,7 @@ import {
22 23
 import {
23 24
   postUserLogout
24 25
 } from '../action-creator.async.js'
25
-import { COOKIE, PAGE } from '../helper.js'
26
+import { COOKIE, PAGE, PROFILE } from '../helper.js'
26 27
 
27 28
 class Header extends React.Component {
28 29
   handleClickLogo = () => {}
@@ -86,6 +87,10 @@ class Header extends React.Component {
86 87
                 onClickSubmit={this.handleClickSubmit}
87 88
               />
88 89
 
90
+              {user.profile === PROFILE.ADMINISTRATOR &&
91
+                <MenuActionListAdminLink t={this.props.t} />
92
+              }
93
+
89 94
               <MenuActionListItemDropdownLang
90 95
                 langList={lang}
91 96
                 idLangActive={user.lang}

+ 6 - 0
frontend/src/css/Header.styl View File

@@ -69,6 +69,12 @@
69 69
           margin-right 30px
70 70
           .btnquestion__icon
71 71
             color darkGrey
72
+      &__adminlink
73
+        margin-right 15px
74
+        .adminlink__btn
75
+          border none
76
+          cursor pointer
77
+          background-color transparent
72 78
       &__itemprofil
73 79
         .profilgroup
74 80
           margin-right 30px