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

[https://github.com/tracim/tracim/issues/779] added integrated version of admin user

Skylsmoi 6 лет назад
Родитель
Сommit
da826c5e8a

+ 74 - 0
frontend_app_admin_workspace_user/src/component/AddMemberForm.jsx Просмотреть файл

@@ -0,0 +1,74 @@
1
+import React from 'react'
2
+
3
+export const AddMemberForm = props =>
4
+  <form className='adminUserPage__adduser__form'>
5
+    <div className='adminUserPage__adduser__form__username'>
6
+      <label className='username__text' htmlFor='adduser'>
7
+        Ajouter un membre
8
+      </label>
9
+
10
+      <input
11
+        type='text'
12
+        className='username__input form-control'
13
+        id='adduser'
14
+        placeholder='Nom ou Email'
15
+      />
16
+
17
+      <div className='username__createaccount'>
18
+        <input type='radio' id='createuseraccount' />
19
+        <label className='ml-2' htmlFor='createuseraccount'>Create an account for this member</label>
20
+      </div>
21
+    </div>
22
+
23
+    <div className='adminUserPage__adduser__form__userrole'>
24
+      <div className='userrole__text'>
25
+        Choose the role of the member
26
+      </div>
27
+
28
+      <div className='userrole__role'>
29
+        <div className='userrole__role__workspacemanager mt-3 d-flex align-items-center'>
30
+          <input type='radio' name='adminuser' />
31
+          <div className='d-flex align-items-center'>
32
+            <div className='userrole__role__icon mx-2'>
33
+              <i className='fa fa-fw fa-gavel' />
34
+            </div>
35
+            Workspace manager
36
+          </div>
37
+        </div>
38
+        <div className='userrole__role__contentmanager mt-3 d-flex align-items-center'>
39
+          <input type='radio' name='adminuser' />
40
+          <div className='d-flex align-items-center'>
41
+            <div className='userrole__role__icon mx-2'>
42
+              <i className='fa fa-fw fa-graduation-cap' />
43
+            </div>
44
+            Content manager
45
+          </div>
46
+        </div>
47
+        <div className='userrole__role__contributor mt-3 d-flex align-items-center'>
48
+          <input type='radio' name='adminuser' />
49
+          <div className='d-flex align-items-center'>
50
+            <div className='userrole__role__icon mx-2'>
51
+              <i className='fa fa-fw fa-pencil' />
52
+            </div>
53
+            Contributor
54
+          </div>
55
+        </div>
56
+        <div className='userrole__role__reader mt-3 d-flex align-items-center'>
57
+          <input type='radio' name='adminuser' />
58
+          <div className='d-flex align-items-center'>
59
+            <div className='userrole__role__icon mx-2'>
60
+              <i className='fa fa-fw fa-eye' />
61
+            </div>
62
+            Reader
63
+          </div>
64
+        </div>
65
+      </div>
66
+    </div>
67
+    <div className='adminUserPage__adduser__form__submit'>
68
+      <button className='btn'>
69
+        Add the member
70
+      </button>
71
+    </div>
72
+  </form>
73
+
74
+export default AddMemberForm

+ 152 - 0
frontend_app_admin_workspace_user/src/component/AdminUser.jsx Просмотреть файл

@@ -0,0 +1,152 @@
1
+import React from 'react'
2
+import {
3
+  Delimiter,
4
+  PageWrapper,
5
+  PageTitle,
6
+  PageContent,
7
+  BtnSwitch
8
+} from 'tracim_frontend_lib'
9
+import AddMemberForm from './AddMemberForm.jsx'
10
+// import { translate } from 'react-i18next'
11
+
12
+export class AdminUser extends React.Component {
13
+  constructor (props) {
14
+    super(props)
15
+
16
+    this.state = {
17
+      displayAddMember: false
18
+    }
19
+  }
20
+
21
+  handleToggleAddMember = () => this.setState(prevState => ({
22
+    displayAddMember: !prevState.displayAddMember
23
+  }))
24
+
25
+  render () {
26
+    return (
27
+      <PageWrapper customClass='adminUserPage'>
28
+        <PageTitle
29
+          parentClass={'adminUserPage'}
30
+          title={"Member's management"}
31
+        />
32
+
33
+        <PageContent parentClass='adminUserPage'>
34
+
35
+          <div className='adminUserPage__description'>
36
+            On this page you can manage the members of your instance Tracim.
37
+          </div>
38
+
39
+          <div className='adminUserPage__adduser'>
40
+            <button className='adminUserPage__adduser__button btn' onClick={this.handleToggleAddMember}>
41
+              Add a member
42
+            </button>
43
+
44
+            {this.state.displayAddMember &&
45
+              <AddMemberForm />
46
+            }
47
+          </div>
48
+
49
+          <Delimiter customClass={'adminUserPage__delimiter'} />
50
+
51
+          <div className='adminUserPage__table'>
52
+            <table className='table'>
53
+              <thead>
54
+                <tr>
55
+                  <th scope='col'>Active</th>
56
+                  <th scope='col'>Member</th>
57
+                  <th scope='col'>Email</th>
58
+                  <th scope='col'>Member can create workspace</th>
59
+                  <th scope='col'>Administrator</th>
60
+                </tr>
61
+              </thead>
62
+              <tbody>
63
+                <tr>
64
+                  <td>
65
+                    <BtnSwitch />
66
+                  </td>
67
+                  <th scope='row'>Joe Delavaiga</th>
68
+                  <td><a href='#'>joedelavaiga@mail.com</a></td>
69
+                  <td>
70
+                    <BtnSwitch />
71
+                  </td>
72
+                  <td>
73
+                    <BtnSwitch />
74
+                  </td>
75
+                </tr>
76
+                <tr>
77
+                  <td>
78
+                    <BtnSwitch />
79
+                  </td>
80
+                  <th scope='row'>Susie Washington</th>
81
+                  <td><a href='#'>susiewash@mail.com</a></td>
82
+                  <td>
83
+                    <BtnSwitch />
84
+                  </td>
85
+                  <td>
86
+                    <BtnSwitch />
87
+                  </td>
88
+                </tr>
89
+                <tr>
90
+                  <td>
91
+                    <BtnSwitch />
92
+                  </td>
93
+                  <th scope='row'>Marty MacJoe</th>
94
+                  <td><a href='#'>martymac@mail.com</a></td>
95
+                  <td>
96
+                    <BtnSwitch />
97
+                  </td>
98
+                  <td>
99
+                    <BtnSwitch />
100
+                  </td>
101
+                </tr>
102
+                <tr>
103
+                  <td>
104
+                    <BtnSwitch />
105
+                  </td>
106
+                  <th scope='row'>Joe Delavaiga</th>
107
+                  <td><a href='#'>joedelavaiga@mail.com</a></td>
108
+                  <td>
109
+                    <BtnSwitch />
110
+                  </td>
111
+                  <td>
112
+                    <BtnSwitch />
113
+                  </td>
114
+                </tr>
115
+                <tr>
116
+                  <td>
117
+                    <BtnSwitch />
118
+                  </td>
119
+                  <th scope='row'>Susie Washington</th>
120
+                  <td><a href='#'>susiewash@mail.com</a></td>
121
+                  <td>
122
+                    <BtnSwitch />
123
+                  </td>
124
+                  <td>
125
+                    <BtnSwitch />
126
+                  </td>
127
+                </tr>
128
+                <tr>
129
+                  <td>
130
+                    <BtnSwitch />
131
+                  </td>
132
+                  <th scope='row'>Marty MacJoe</th>
133
+                  <td><a href='#'>martymac@mail.com</a></td>
134
+                  <td>
135
+                    <BtnSwitch />
136
+                  </td>
137
+                  <td>
138
+                    <BtnSwitch />
139
+                  </td>
140
+                </tr>
141
+              </tbody>
142
+            </table>
143
+          </div>
144
+
145
+        </PageContent>
146
+
147
+      </PageWrapper>
148
+    )
149
+  }
150
+}
151
+
152
+export default AdminUser

+ 2 - 1
frontend_app_admin_workspace_user/src/container/AdminWorkspaceUser.jsx Просмотреть файл

@@ -9,6 +9,7 @@ import { debug } from '../helper.js'
9 9
 import {
10 10
 } from '../action.async.js'
11 11
 import AdminWorkspace from '../component/AdminWorkspace.jsx'
12
+import AdminUser from '../component/AdminUser.jsx'
12 13
 
13 14
 require('../css/index.styl')
14 15
 
@@ -76,7 +77,7 @@ class AdminWorkspaceUser extends React.Component {
76 77
         }
77 78
 
78 79
         {this.state.config.type === 'user' &&
79
-          <div>not yet implemented</div>
80
+          <AdminUser />
80 81
         }
81 82
       </div>
82 83
     )

+ 35 - 2
frontend_app_admin_workspace_user/src/css/index.styl Просмотреть файл

@@ -1,7 +1,10 @@
1 1
 @import "../../node_modules/tracim_frontend_lib/src/css/Variable.styl"
2 2
 
3
-.table th
4
-  vertical-align middle
3
+.table
4
+  th
5
+    vertical-align middle
6
+  td a:hover
7
+    text-decoration underline
5 8
 
6 9
 .adminWorkspacePage
7 10
   &__createworkspace
@@ -19,3 +22,33 @@
19 22
       align-items center
20 23
       flex-wrap wrap
21 24
       cursor pointer
25
+
26
+.adminUserPage
27
+  &__description
28
+    margin-bottom 40px
29
+  &__adduser
30
+    margin 25px 0
31
+    &__button
32
+      margin-bottom 20px
33
+    &__form
34
+      border 1px solid grey
35
+      border-radius 5px
36
+      padding 20px
37
+      &__username
38
+        .username
39
+        &__text
40
+          font-weight bold
41
+        &__input
42
+          margin 15px 0 20px 0
43
+          width 40%
44
+      &__userrole
45
+        .userrole
46
+        &__text
47
+          margin 20px 0
48
+          font-weight bold
49
+        &__role
50
+          margin 25px 0
51
+  &__delimiter
52
+    margin 50px auto
53
+  &__table
54
+    margin-bottom 100px

+ 1 - 1
frontend_app_admin_workspace_user/src/helper.js Просмотреть файл

@@ -11,7 +11,7 @@ export const debug = {
11 11
     slug: 'admin_workspace_user',
12 12
     faIcon: 'file-text-o',
13 13
     hexcolor: '#7d4e24',
14
-    type: 'workspace',
14
+    type: 'user',
15 15
     translation: {en: {}, fr: {}}
16 16
   },
17 17
   loggedUser: { // @FIXME this object is outdated