File tree Expand file tree Collapse file tree 3 files changed +22
-10
lines changed
projects/create/containers Expand file tree Collapse file tree 3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -3,17 +3,23 @@ import { Link } from 'react-router-dom'
33import SVGIconImage from '../SVGIconImage'
44import './NewProjectNavLink.scss'
55
6- const NewProjectNavLink = ( { compact= false } ) => {
6+ const NewProjectNavLink = ( { compact= false , returnUrl } ) => {
77 if ( compact ) {
88 return (
9- < Link to = "/new-project" className = "new-project-link" >
9+ < Link to = { {
10+ pathname : '/new-project' ,
11+ search : returnUrl ? '?returnUrl=' + returnUrl : ''
12+ } } className = "new-project-link" >
1013 < div className = "new-project-icon" > < SVGIconImage filePath = "ui-16px-1_bold-add" /> </ div >
1114 </ Link >
1215 )
1316 } else {
1417 return (
1518 < div className = "new-project-link" >
16- < Link to = "/new-project" className = "tc-btn tc-btn-sm tc-btn-primary" > + New Project</ Link >
19+ < Link to = { {
20+ pathname : '/new-project' ,
21+ search : returnUrl ? '?returnUrl=' + returnUrl : '' ,
22+ } } className = "tc-btn tc-btn-sm tc-btn-primary" > + New Project</ Link >
1723 </ div >
1824 )
1925 }
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ class ProjectToolBar extends React.Component {
7171 }
7272 </ ul >
7373 </ nav > }
74- < NewProjectNavLink compact />
74+ < NewProjectNavLink compact returnUrl = { window . location . href } />
7575 { userMenu }
7676 </ div >
7777 </ div >
Original file line number Diff line number Diff line change 11import _ from 'lodash'
22import Cookies from 'js-cookie'
3+ import qs from 'query-string'
34import React , { PropTypes } from 'react'
45import { withRouter } from 'react-router-dom'
56import { connect } from 'react-redux'
@@ -178,16 +179,21 @@ class CreateConainer extends React.Component {
178179 }
179180
180181 closeWizard ( ) {
181- const { userRoles } = this . props
182+ const { userRoles, location } = this . props
182183 const isLoggedIn = userRoles && userRoles . length > 0
183184 // calls leave handler
184185 this . onLeave ( )
185- if ( isLoggedIn ) {
186- this . props . history . push ( '/projects' )
186+ const returnUrl = _ . get ( qs . parse ( location . search ) , 'returnUrl' , null )
187+ if ( returnUrl ) {
188+ window . location = returnUrl
187189 } else {
188- // this.props.history.push('/')
189- // FIXME ideally we should push on router
190- window . location = window . location . origin
190+ if ( isLoggedIn ) {
191+ this . props . history . push ( '/projects' )
192+ } else {
193+ this . props . history . push ( '/' )
194+ // FIXME ideally we should push on router
195+ // window.location = window.location.origin
196+ }
191197 }
192198 }
193199
You can’t perform that action at this time.
0 commit comments