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 5 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,17 +237,20 @@ class Dashboard extends React.Component {
237 237
             </div>
238 238
 
239 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 254
             </div>
252 255
 
253 256
             <div className='dashboard__workspaceInfo'>

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

@@ -165,7 +165,7 @@ class WorkspaceContent extends React.Component {
165 165
 
166 166
   handleClickCreateContent = (e, idFolder, contentType) => {
167 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 171
   handleUpdateAppOpenedType = openedAppType => this.setState({appOpenedType: openedAppType})
@@ -216,7 +216,7 @@ class WorkspaceContent extends React.Component {
216 216
               parentClass='workspace__header__btnaddcontent'
217 217
               idFolder={null} // null because it is workspace root content
218 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 221
           </PageTitle>
222 222
 
@@ -227,7 +227,7 @@ class WorkspaceContent extends React.Component {
227 227
               { filteredWorkspaceContentList.map((c, i) => c.type === 'folder'
228 228
                 ? (
229 229
                   <Folder
230
-                    availableApp={contentType}
230
+                    availableApp={contentType.filter(ct => ct.slug !== 'comment')} // @FIXME: Côme - 2018/08/21 - should use props.appList
231 231
                     folderData={c}
232 232
                     onClickItem={this.handleClickContentItem}
233 233
                     onClickExtendedAction={{
@@ -270,7 +270,7 @@ class WorkspaceContent extends React.Component {
270 270
               customClass='workspace__content__button'
271 271
               idFolder={null}
272 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 275
           </PageContent>
276 276