|
@@ -1,6 +1,6 @@
|
1
|
1
|
import React from 'react'
|
2
|
2
|
import { connect } from 'react-redux'
|
3
|
|
-import { withRouter } from 'react-router-dom'
|
|
3
|
+import { withRouter, Route } from 'react-router-dom'
|
4
|
4
|
import appFactory from '../appFactory.js'
|
5
|
5
|
import { PAGE } from '../helper.js'
|
6
|
6
|
import Sidebar from './Sidebar.jsx'
|
|
@@ -11,7 +11,8 @@ import PageWrapper from '../component/common/layout/PageWrapper.jsx'
|
11
|
11
|
import PageTitle from '../component/common/layout/PageTitle.jsx'
|
12
|
12
|
import PageContent from '../component/common/layout/PageContent.jsx'
|
13
|
13
|
import DropdownCreateButton from '../component/common/Input/DropdownCreateButton.jsx'
|
14
|
|
-import OpenContentApp from './OpenContentApp.jsx'
|
|
14
|
+import OpenContentApp from '../component/Workspace/OpenContentApp.jsx'
|
|
15
|
+import OpenCreateContentApp from '../component/Workspace/OpenCreateContentApp.jsx'
|
15
|
16
|
import {
|
16
|
17
|
getAppList,
|
17
|
18
|
getContentTypeList,
|
|
@@ -59,6 +60,7 @@ class WorkspaceContent extends React.Component {
|
59
|
60
|
break
|
60
|
61
|
|
61
|
62
|
case 'appClosed':
|
|
63
|
+ case 'hide_popupCreateContent':
|
62
|
64
|
console.log('%c<WorkspaceContent> Custom event', 'color: #28a745', type, data, this.state.workspaceIdInUrl)
|
63
|
65
|
this.props.history.push(PAGE.WORKSPACE.CONTENT_LIST(this.state.workspaceIdInUrl))
|
64
|
66
|
this.setState({appOpenedType: false})
|
|
@@ -173,12 +175,7 @@ class WorkspaceContent extends React.Component {
|
173
|
175
|
|
174
|
176
|
handleClickCreateContent = (e, idFolder, contentType) => {
|
175
|
177
|
e.stopPropagation()
|
176
|
|
- this.props.renderCreateContentApp(
|
177
|
|
- this.props.contentType.find(ct => ct.slug === contentType),
|
178
|
|
- this.props.user,
|
179
|
|
- this.props.match.params.idws,
|
180
|
|
- idFolder
|
181
|
|
- )
|
|
178
|
+ this.props.history.push(`${PAGE.WORKSPACE.NEW(this.state.workspaceIdInUrl, contentType, idFolder)}?parent_id=${idFolder}`)
|
182
|
179
|
}
|
183
|
180
|
|
184
|
181
|
handleUpdateAppOpenedType = openedAppType => this.setState({appOpenedType: openedAppType})
|
|
@@ -206,11 +203,20 @@ class WorkspaceContent extends React.Component {
|
206
|
203
|
<Sidebar />
|
207
|
204
|
|
208
|
205
|
<OpenContentApp
|
|
206
|
+ // automatically open the app for the idContent in url
|
209
|
207
|
idWorkspace={this.state.workspaceIdInUrl}
|
210
|
208
|
appOpenedType={this.state.appOpenedType}
|
211
|
209
|
updateAppOpenedType={this.handleUpdateAppOpenedType}
|
212
|
210
|
/>
|
213
|
211
|
|
|
212
|
+ <Route path={PAGE.WORKSPACE.NEW(':idws', ':type')} component={() =>
|
|
213
|
+ <OpenCreateContentApp
|
|
214
|
+ // automatically open the popup create content of the app in url
|
|
215
|
+ idWorkspace={this.state.workspaceIdInUrl}
|
|
216
|
+ appOpenedType={this.state.appOpenedType}
|
|
217
|
+ />
|
|
218
|
+ } />
|
|
219
|
+
|
214
|
220
|
<PageWrapper customeClass='workspace'>
|
215
|
221
|
<PageTitle
|
216
|
222
|
parentClass='workspace__header'
|
|
@@ -219,7 +225,7 @@ class WorkspaceContent extends React.Component {
|
219
|
225
|
>
|
220
|
226
|
<DropdownCreateButton
|
221
|
227
|
parentClass='workspace__header__btnaddworkspace'
|
222
|
|
- idFolder={null}
|
|
228
|
+ idFolder={null} // null because it is workspace root content
|
223
|
229
|
onClickCreateContent={this.handleClickCreateContent}
|
224
|
230
|
availableApp={contentType}
|
225
|
231
|
/>
|