Browse Source

[https://github.com/tracim/tracim/issues/816] fixed url for btn create content in dashboard + removed comment from content type list in create content dropdown

Skylsmoi 6 years ago
parent
commit
1508af8a44
2 changed files with 18 additions and 15 deletions
  1. 14 11
      frontend/src/container/Dashboard.jsx
  2. 4 4
      frontend/src/container/WorkspaceContent.jsx

+ 14 - 11
frontend/src/container/Dashboard.jsx View File

237
             </div>
237
             </div>
238
 
238
 
239
             <div className='dashboard__calltoaction justify-content-xl-center'>
239
             <div className='dashboard__calltoaction justify-content-xl-center'>
240
-              {props.appList.map(app =>
241
-                <ContentTypeBtn
242
-                  customClass='dashboard__calltoaction__button'
243
-                  hexcolor={app.hexcolor}
244
-                  label={app.label}
245
-                  faIcon={app.faIcon}
246
-                  creationLabel={(props.contentType.find(ct => app.slug.includes(ct.slug)) || {creationLabel: ''}).creationLabel}
247
-                  onClickBtn={() => props.history.push(PAGE.WORKSPACE.NEW(props.curWs.id, app.slug))}
248
-                  key={app.label}
249
-                />
250
-              )}
240
+              {props.appList.map(app => {
241
+                const contentType = props.contentType.find(ct => app.slug.includes(ct.slug)) || {creationLabel: '', slug: ''}
242
+                return (
243
+                  <ContentTypeBtn
244
+                    customClass='dashboard__calltoaction__button'
245
+                    hexcolor={app.hexcolor}
246
+                    label={app.label}
247
+                    faIcon={app.faIcon}
248
+                    creationLabel={contentType.creationLabel}
249
+                    onClickBtn={() => props.history.push(`${PAGE.WORKSPACE.NEW(props.curWs.id, contentType.slug)}?parent_id=null`)}
250
+                    key={app.label}
251
+                  />
252
+                )
253
+              })}
251
             </div>
254
             </div>
252
 
255
 
253
             <div className='dashboard__workspaceInfo'>
256
             <div className='dashboard__workspaceInfo'>

+ 4 - 4
frontend/src/container/WorkspaceContent.jsx View File

165
 
165
 
166
   handleClickCreateContent = (e, idFolder, contentType) => {
166
   handleClickCreateContent = (e, idFolder, contentType) => {
167
     e.stopPropagation()
167
     e.stopPropagation()
168
-    this.props.history.push(`${PAGE.WORKSPACE.NEW(this.state.workspaceIdInUrl, contentType, idFolder)}?parent_id=${idFolder}`)
168
+    this.props.history.push(`${PAGE.WORKSPACE.NEW(this.state.workspaceIdInUrl, contentType)}?parent_id=${idFolder}`)
169
   }
169
   }
170
 
170
 
171
   handleUpdateAppOpenedType = openedAppType => this.setState({appOpenedType: openedAppType})
171
   handleUpdateAppOpenedType = openedAppType => this.setState({appOpenedType: openedAppType})
216
               parentClass='workspace__header__btnaddcontent'
216
               parentClass='workspace__header__btnaddcontent'
217
               idFolder={null} // null because it is workspace root content
217
               idFolder={null} // null because it is workspace root content
218
               onClickCreateContent={this.handleClickCreateContent}
218
               onClickCreateContent={this.handleClickCreateContent}
219
-              availableApp={contentType}
219
+              availableApp={contentType.filter(ct => ct.slug !== 'comment')} // @FIXME: Côme - 2018/08/21 - should use props.appList
220
             />
220
             />
221
           </PageTitle>
221
           </PageTitle>
222
 
222
 
227
               { filteredWorkspaceContentList.map((c, i) => c.type === 'folder'
227
               { filteredWorkspaceContentList.map((c, i) => c.type === 'folder'
228
                 ? (
228
                 ? (
229
                   <Folder
229
                   <Folder
230
-                    availableApp={contentType}
230
+                    availableApp={contentType.filter(ct => ct.slug !== 'comment')} // @FIXME: Côme - 2018/08/21 - should use props.appList
231
                     folderData={c}
231
                     folderData={c}
232
                     onClickItem={this.handleClickContentItem}
232
                     onClickItem={this.handleClickContentItem}
233
                     onClickExtendedAction={{
233
                     onClickExtendedAction={{
270
               customClass='workspace__content__button'
270
               customClass='workspace__content__button'
271
               idFolder={null}
271
               idFolder={null}
272
               onClickCreateContent={this.handleClickCreateContent}
272
               onClickCreateContent={this.handleClickCreateContent}
273
-              availableApp={contentType}
273
+              availableApp={contentType.filter(ct => ct.slug !== 'comment')} // @FIXME: Côme - 2018/08/21 - should use props.appList
274
             />
274
             />
275
           </PageContent>
275
           </PageContent>
276
 
276