mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Convert usage of router from context to using withRouter
This commit is contained in:
parent
d5a722259b
commit
6b67a8462f
js/components
ascribe_detail
ascribe_forms
ascribe_routes
ascribe_slides_container
password_reset_container.jspiece_list.jsregister_piece.jssignup_container.jswhitelabel/wallet
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import Row from 'react-bootstrap/lib/Row';
|
import Row from 'react-bootstrap/lib/Row';
|
||||||
import Col from 'react-bootstrap/lib/Col';
|
import Col from 'react-bootstrap/lib/Col';
|
||||||
@ -33,20 +34,17 @@ import { getLangText } from '../../utils/lang_utils';
|
|||||||
A component that handles all the actions inside of the edition detail
|
A component that handles all the actions inside of the edition detail
|
||||||
handleSuccess requires a loadEdition action (could be refactored)
|
handleSuccess requires a loadEdition action (could be refactored)
|
||||||
*/
|
*/
|
||||||
let EditionActionPanel = React.createClass({
|
const EditionActionPanel = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
currentUser: React.PropTypes.object.isRequired,
|
currentUser: React.PropTypes.object.isRequired,
|
||||||
edition: React.PropTypes.object.isRequired,
|
edition: React.PropTypes.object.isRequired,
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
whitelabel: React.PropTypes.object.isRequired,
|
whitelabel: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
actionPanelButtonListType: React.PropTypes.func,
|
actionPanelButtonListType: React.PropTypes.func,
|
||||||
handleSuccess: React.PropTypes.func
|
handleSuccess: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getDefaultProps() {
|
getDefaultProps() {
|
||||||
return {
|
return {
|
||||||
actionPanelButtonListType: AclButtonList
|
actionPanelButtonListType: AclButtonList
|
||||||
@ -78,7 +76,7 @@ let EditionActionPanel = React.createClass({
|
|||||||
const notification = new GlobalNotificationModel(response.notification, 'success');
|
const notification = new GlobalNotificationModel(response.notification, 'success');
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshCollection() {
|
refreshCollection() {
|
||||||
@ -190,4 +188,4 @@ let EditionActionPanel = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default EditionActionPanel;
|
export default withRouter(EditionActionPanel);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
import Moment from 'moment';
|
import Moment from 'moment';
|
||||||
|
|
||||||
import ReactError from '../../mixins/react_error';
|
import ReactError from '../../mixins/react_error';
|
||||||
@ -46,8 +47,10 @@ import { setDocumentTitle } from '../../utils/dom_utils';
|
|||||||
/**
|
/**
|
||||||
* This is the component that implements resource/data specific functionality
|
* This is the component that implements resource/data specific functionality
|
||||||
*/
|
*/
|
||||||
let PieceContainer = React.createClass({
|
const PieceContainer = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
furtherDetailsType: React.PropTypes.func,
|
furtherDetailsType: React.PropTypes.func,
|
||||||
|
|
||||||
// Provided from AscribeApp
|
// Provided from AscribeApp
|
||||||
@ -59,10 +62,6 @@ let PieceContainer = React.createClass({
|
|||||||
params: React.PropTypes.object
|
params: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
mixins: [ReactError],
|
mixins: [ReactError],
|
||||||
|
|
||||||
getDefaultProps() {
|
getDefaultProps() {
|
||||||
@ -167,7 +166,7 @@ let PieceContainer = React.createClass({
|
|||||||
const notification = new GlobalNotificationModel(response.notification, 'success');
|
const notification = new GlobalNotificationModel(response.notification, 'success');
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
},
|
},
|
||||||
|
|
||||||
getCreateEditionsDialog() {
|
getCreateEditionsDialog() {
|
||||||
@ -347,4 +346,4 @@ let PieceContainer = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default PieceContainer;
|
export default withRouter(PieceContainer);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import ContractListActions from '../../actions/contract_list_actions';
|
import ContractListActions from '../../actions/contract_list_actions';
|
||||||
import ContractListStore from '../../stores/contract_list_store';
|
import ContractListStore from '../../stores/contract_list_store';
|
||||||
@ -19,15 +20,11 @@ import { getLangText } from '../../utils/lang_utils';
|
|||||||
import { mergeOptions } from '../../utils/general_utils';
|
import { mergeOptions } from '../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let SendContractAgreementForm = React.createClass({
|
const SendContractAgreementForm = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
handleSuccess: React.PropTypes.func
|
handleSuccess: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
ContractListStore.getState(),
|
ContractListStore.getState(),
|
||||||
@ -58,7 +55,7 @@ let SendContractAgreementForm = React.createClass({
|
|||||||
const notification = new GlobalNotificationModel(getLangText('Contract agreement sent'), 'success', 10000);
|
const notification = new GlobalNotificationModel(getLangText('Contract agreement sent'), 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormData() {
|
getFormData() {
|
||||||
@ -152,4 +149,4 @@ let SendContractAgreementForm = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default SendContractAgreementForm;
|
export default withRouter(SendContractAgreementForm);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import UserStore from '../../stores/user_store';
|
import UserStore from '../../stores/user_store';
|
||||||
|
|
||||||
@ -75,10 +76,12 @@ export function AuthRedirect({ to, when }) {
|
|||||||
*/
|
*/
|
||||||
export function ProxyHandler(...redirectFunctions) {
|
export function ProxyHandler(...redirectFunctions) {
|
||||||
return (Component) => (
|
return (Component) => (
|
||||||
React.createClass({
|
withRouter(React.createClass({
|
||||||
displayName: 'ProxyHandler',
|
displayName: 'ProxyHandler',
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
// Provided from AscribeApp, after the routes have been initialized
|
// Provided from AscribeApp, after the routes have been initialized
|
||||||
currentUser: React.PropTypes.object,
|
currentUser: React.PropTypes.object,
|
||||||
whitelabel: React.PropTypes.object,
|
whitelabel: React.PropTypes.object,
|
||||||
@ -88,10 +91,6 @@ export function ProxyHandler(...redirectFunctions) {
|
|||||||
route: object
|
route: object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: object
|
|
||||||
},
|
|
||||||
|
|
||||||
childContextTypes: {
|
childContextTypes: {
|
||||||
route: object
|
route: object
|
||||||
},
|
},
|
||||||
@ -111,7 +110,7 @@ export function ProxyHandler(...redirectFunctions) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
evaluateRedirectFunctions(props = this.props) {
|
evaluateRedirectFunctions(props = this.props) {
|
||||||
const { currentUser, location: { query } } = props;
|
const { currentUser, location: { query }, router } = props;
|
||||||
|
|
||||||
if (UserStore.hasLoaded() && !UserStore.isLoading()) {
|
if (UserStore.hasLoaded() && !UserStore.isLoading()) {
|
||||||
for (let i = 0; i < redirectFunctions.length; i++) {
|
for (let i = 0; i < redirectFunctions.length; i++) {
|
||||||
@ -119,7 +118,7 @@ export function ProxyHandler(...redirectFunctions) {
|
|||||||
// it should return `true` and therefore
|
// it should return `true` and therefore
|
||||||
// stop/avoid the execution of all functions
|
// stop/avoid the execution of all functions
|
||||||
// that follow
|
// that follow
|
||||||
if (redirectFunctions[i](this.context.router, currentUser, query)) {
|
if (redirectFunctions[i](router, currentUser, query)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,5 +131,5 @@ export function ProxyHandler(...redirectFunctions) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import SlidesContainerBreadcrumbs from './slides_container_breadcrumbs';
|
import SlidesContainerBreadcrumbs from './slides_container_breadcrumbs';
|
||||||
|
|
||||||
@ -9,9 +10,10 @@ const { arrayOf, element, bool, shape, string, object } = React.PropTypes;
|
|||||||
|
|
||||||
const SlidesContainer = React.createClass({
|
const SlidesContainer = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
children: arrayOf(element),
|
|
||||||
forwardProcess: bool.isRequired,
|
forwardProcess: bool.isRequired,
|
||||||
|
router: object.isRequired,
|
||||||
|
|
||||||
|
children: arrayOf(element),
|
||||||
glyphiconClassNames: shape({
|
glyphiconClassNames: shape({
|
||||||
pending: string,
|
pending: string,
|
||||||
complete: string
|
complete: string
|
||||||
@ -21,8 +23,7 @@ const SlidesContainer = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
contextTypes: {
|
||||||
route: object.isRequired,
|
route: object.isRequired
|
||||||
router: object.isRequired
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
@ -42,8 +43,7 @@ const SlidesContainer = React.createClass({
|
|||||||
|
|
||||||
// Since react-router 2.0.0, we need to define the `routerWillLeave`
|
// Since react-router 2.0.0, we need to define the `routerWillLeave`
|
||||||
// method ourselves.
|
// method ourselves.
|
||||||
const { router, route } = this.context;
|
this.props.router.setRouteLeaveHook(this.context.route, this.routerWillLeave);
|
||||||
router.setRouteLeaveHook(route, this.routerWillLeave);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@ -68,10 +68,10 @@ const SlidesContainer = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setSlideNum(nextSlideNum, additionalQueryParams = {}) {
|
setSlideNum(nextSlideNum, additionalQueryParams = {}) {
|
||||||
const { location: { pathname, query } } = this.props;
|
const { location: { pathname, query }, router } = this.props;
|
||||||
const slideQuery = Object.assign({}, query, additionalQueryParams, { slide_num: nextSlideNum });
|
const slideQuery = Object.assign({}, query, additionalQueryParams, { slide_num: nextSlideNum });
|
||||||
|
|
||||||
this.context.router.push({ pathname, query: slideQuery });
|
router.push({ pathname, query: slideQuery });
|
||||||
},
|
},
|
||||||
|
|
||||||
// breadcrumbs are defined as attributes of the slides.
|
// breadcrumbs are defined as attributes of the slides.
|
||||||
@ -186,4 +186,4 @@ const SlidesContainer = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default SlidesContainer;
|
export default withRouter(SlidesContainer);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import Form from './ascribe_forms/form';
|
import Form from './ascribe_forms/form';
|
||||||
import Property from './ascribe_forms/property';
|
import Property from './ascribe_forms/property';
|
||||||
@ -107,16 +108,14 @@ let PasswordRequestResetForm = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let PasswordResetForm = React.createClass({
|
let PasswordResetForm = withRouter(React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
email: React.PropTypes.string,
|
email: React.PropTypes.string,
|
||||||
token: React.PropTypes.string
|
token: React.PropTypes.string
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getFormData() {
|
getFormData() {
|
||||||
return {
|
return {
|
||||||
email: this.props.email,
|
email: this.props.email,
|
||||||
@ -125,7 +124,7 @@ let PasswordResetForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleSuccess() {
|
handleSuccess() {
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
|
|
||||||
const notification = new GlobalNotificationModel(getLangText('Password successfully updated'), 'success', 10000);
|
const notification = new GlobalNotificationModel(getLangText('Password successfully updated'), 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
@ -176,6 +175,6 @@ let PasswordResetForm = React.createClass({
|
|||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
|
|
||||||
export default PasswordResetContainer;
|
export default PasswordResetContainer;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import PieceListStore from '../stores/piece_list_store';
|
import PieceListStore from '../stores/piece_list_store';
|
||||||
import PieceListActions from '../actions/piece_list_actions';
|
import PieceListActions from '../actions/piece_list_actions';
|
||||||
@ -30,8 +29,10 @@ import { getLangText } from '../utils/lang_utils';
|
|||||||
import { setDocumentTitle } from '../utils/dom_utils';
|
import { setDocumentTitle } from '../utils/dom_utils';
|
||||||
|
|
||||||
|
|
||||||
let PieceList = React.createClass({
|
const PieceList = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
accordionListItemType: React.PropTypes.func,
|
accordionListItemType: React.PropTypes.func,
|
||||||
bulkModalButtonListType: React.PropTypes.func,
|
bulkModalButtonListType: React.PropTypes.func,
|
||||||
canLoadPieceList: React.PropTypes.bool,
|
canLoadPieceList: React.PropTypes.bool,
|
||||||
@ -54,10 +55,6 @@ let PieceList = React.createClass({
|
|||||||
location: React.PropTypes.object
|
location: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getDefaultProps() {
|
getDefaultProps() {
|
||||||
return {
|
return {
|
||||||
accordionListItemType: AccordionListItemWallet,
|
accordionListItemType: AccordionListItemWallet,
|
||||||
@ -130,13 +127,13 @@ let PieceList = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { location: { query }, redirectTo, shouldRedirect } = this.props;
|
const { location: { query }, redirectTo, router, shouldRedirect } = this.props;
|
||||||
const { unfilteredPieceListCount } = this.state;
|
const { unfilteredPieceListCount } = this.state;
|
||||||
|
|
||||||
if (redirectTo && redirectTo.pathname &&
|
if (redirectTo && redirectTo.pathname &&
|
||||||
(typeof shouldRedirect === 'function' && shouldRedirect(unfilteredPieceListCount))) {
|
(typeof shouldRedirect === 'function' && shouldRedirect(unfilteredPieceListCount))) {
|
||||||
// FIXME: hack to redirect out of the dispatch cycle
|
// FIXME: hack to redirect out of the dispatch cycle
|
||||||
window.setTimeout(() => this.context.router.push({
|
window.setTimeout(() => router.push({
|
||||||
// Occasionally, the back end also sets query parameters for Onion.
|
// Occasionally, the back end also sets query parameters for Onion.
|
||||||
// We need to consider this by merging all passed query parameters, as we'll
|
// We need to consider this by merging all passed query parameters, as we'll
|
||||||
// otherwise end up in a 404 screen
|
// otherwise end up in a 404 screen
|
||||||
@ -196,14 +193,14 @@ let PieceList = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
searchFor(search) {
|
searchFor(search) {
|
||||||
const { location: { pathname } } = this.props;
|
const { location: { pathname }, router } = this.props;
|
||||||
|
|
||||||
this.loadPieceList({ search, page: 1 });
|
this.loadPieceList({ search, page: 1 });
|
||||||
this.context.router.push({ pathname, query: { page: 1 } });
|
router.push({ pathname, query: { page: 1 } });
|
||||||
},
|
},
|
||||||
|
|
||||||
applyFilterBy(filterBy) {
|
applyFilterBy(filterBy) {
|
||||||
const { pathname } = this.props.location;
|
const { location: { pathname }, router } = this.props;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isFilterDirty: true
|
isFilterDirty: true
|
||||||
@ -229,7 +226,7 @@ let PieceList = React.createClass({
|
|||||||
|
|
||||||
// we have to redirect the user always to page one as it could be that there is no page two
|
// we have to redirect the user always to page one as it could be that there is no page two
|
||||||
// for filtered pieces
|
// for filtered pieces
|
||||||
this.context.router.push({ pathname, query: { page: 1 } });
|
router.push({ pathname, query: { page: 1 } });
|
||||||
},
|
},
|
||||||
|
|
||||||
applyOrderBy(orderBy) {
|
applyOrderBy(orderBy) {
|
||||||
@ -361,4 +358,4 @@ let PieceList = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default PieceList;
|
export default withRouter(PieceList);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import Col from 'react-bootstrap/lib/Col';
|
import Col from 'react-bootstrap/lib/Col';
|
||||||
import Row from 'react-bootstrap/lib/Row';
|
import Row from 'react-bootstrap/lib/Row';
|
||||||
@ -18,8 +17,10 @@ import { getLangText } from '../utils/lang_utils';
|
|||||||
import { setDocumentTitle } from '../utils/dom_utils';
|
import { setDocumentTitle } from '../utils/dom_utils';
|
||||||
|
|
||||||
|
|
||||||
let RegisterPiece = React.createClass( {
|
const RegisterPiece = React.createClass( {
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
headerMessage: React.PropTypes.string,
|
headerMessage: React.PropTypes.string,
|
||||||
submitMessage: React.PropTypes.string,
|
submitMessage: React.PropTypes.string,
|
||||||
children: React.PropTypes.oneOfType([
|
children: React.PropTypes.oneOfType([
|
||||||
@ -36,10 +37,6 @@ let RegisterPiece = React.createClass( {
|
|||||||
location: React.PropTypes.object
|
location: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState(){
|
getInitialState(){
|
||||||
return PieceListStore.getState();
|
return PieceListStore.getState();
|
||||||
},
|
},
|
||||||
@ -66,7 +63,7 @@ let RegisterPiece = React.createClass( {
|
|||||||
// the piece list up to date
|
// the piece list up to date
|
||||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
this.context.router.push(`/pieces/${response.piece.id}`);
|
this.props.router.push(`/pieces/${response.piece.id}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSpecifyEditions() {
|
getSpecifyEditions() {
|
||||||
@ -109,4 +106,4 @@ let RegisterPiece = React.createClass( {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export default RegisterPiece;
|
export default withRouter(RegisterPiece);
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Link from 'react-router/es6/Link';
|
import Link from 'react-router/es6/Link';
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import EditionListActions from '../../../../../../actions/edition_list_actions';
|
import EditionListActions from '../../../../../../actions/edition_list_actions';
|
||||||
|
|
||||||
@ -28,8 +27,10 @@ import { setDocumentTitle } from '../../../../../../utils/dom_utils';
|
|||||||
import { mergeOptions } from '../../../../../../utils/general_utils';
|
import { mergeOptions } from '../../../../../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let CylandPieceContainer = React.createClass({
|
const CylandPieceContainer = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
// Provided from WalletApp
|
// Provided from WalletApp
|
||||||
currentUser: React.PropTypes.object.isRequired,
|
currentUser: React.PropTypes.object.isRequired,
|
||||||
whitelabel: React.PropTypes.object,
|
whitelabel: React.PropTypes.object,
|
||||||
@ -39,10 +40,6 @@ let CylandPieceContainer = React.createClass({
|
|||||||
params: React.PropTypes.object
|
params: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
PieceStore.getInitialState(),
|
PieceStore.getInitialState(),
|
||||||
@ -91,7 +88,7 @@ let CylandPieceContainer = React.createClass({
|
|||||||
const notification = new GlobalNotificationModel(response.notification, 'success');
|
const notification = new GlobalNotificationModel(response.notification, 'success');
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -130,4 +127,4 @@ let CylandPieceContainer = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default CylandPieceContainer;
|
export default withRouter(CylandPieceContainer);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import Moment from 'moment';
|
import Moment from 'moment';
|
||||||
|
|
||||||
@ -33,8 +32,10 @@ import { mergeOptions } from '../../../../../utils/general_utils';
|
|||||||
import { getAclFormMessage } from '../../../../../utils/form_utils';
|
import { getAclFormMessage } from '../../../../../utils/form_utils';
|
||||||
|
|
||||||
|
|
||||||
let CylandRegisterPiece = React.createClass({
|
const CylandRegisterPiece = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
// Provided from WalletApp
|
// Provided from WalletApp
|
||||||
currentUser: React.PropTypes.object.isRequired,
|
currentUser: React.PropTypes.object.isRequired,
|
||||||
whitelabel: React.PropTypes.object.isRequired,
|
whitelabel: React.PropTypes.object.isRequired,
|
||||||
@ -43,10 +44,6 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
location: React.PropTypes.object
|
location: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState(){
|
getInitialState(){
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
PieceListStore.getState(),
|
PieceListStore.getState(),
|
||||||
@ -111,7 +108,7 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
|
|
||||||
this.refreshPieceList();
|
this.refreshPieceList();
|
||||||
|
|
||||||
this.context.router.push(`/pieces/${this.state.piece.id}`);
|
this.props.router.push(`/pieces/${this.state.piece.id}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
nextSlide(queryParams) {
|
nextSlide(queryParams) {
|
||||||
@ -221,4 +218,4 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default CylandRegisterPiece;
|
export default withRouter(CylandRegisterPiece);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
||||||
import Button from 'react-bootstrap/lib/Button';
|
import Button from 'react-bootstrap/lib/Button';
|
||||||
@ -22,8 +21,10 @@ import { getLangText } from '../../../../../utils/lang_utils';
|
|||||||
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||||
|
|
||||||
|
|
||||||
let IkonotvContractNotifications = React.createClass({
|
const IkonotvContractNotifications = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
// Provided from WalletApp
|
// Provided from WalletApp
|
||||||
currentUser: React.PropTypes.object.isRequired,
|
currentUser: React.PropTypes.object.isRequired,
|
||||||
whitelabel: React.PropTypes.object.isRequired,
|
whitelabel: React.PropTypes.object.isRequired,
|
||||||
@ -32,10 +33,6 @@ let IkonotvContractNotifications = React.createClass({
|
|||||||
location: React.PropTypes.object
|
location: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return NotificationStore.getState();
|
return NotificationStore.getState();
|
||||||
},
|
},
|
||||||
@ -116,7 +113,7 @@ let IkonotvContractNotifications = React.createClass({
|
|||||||
NotificationActions.flushContractAgreementListNotifications();
|
NotificationActions.flushContractAgreementListNotifications();
|
||||||
NotificationActions.fetchContractAgreementListNotifications();
|
NotificationActions.fetchContractAgreementListNotifications();
|
||||||
|
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDeny() {
|
handleDeny() {
|
||||||
@ -130,7 +127,7 @@ let IkonotvContractNotifications = React.createClass({
|
|||||||
const notification = new GlobalNotificationModel(getLangText('You have denied the conditions'), 'success', 5000);
|
const notification = new GlobalNotificationModel(getLangText('You have denied the conditions'), 'success', 5000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
},
|
},
|
||||||
|
|
||||||
getCopyrightAssociationForm(){
|
getCopyrightAssociationForm(){
|
||||||
@ -201,4 +198,4 @@ let IkonotvContractNotifications = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default IkonotvContractNotifications;
|
export default withRouter(IkonotvContractNotifications);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import EditionListActions from '../../../../../../actions/edition_list_actions';
|
import EditionListActions from '../../../../../../actions/edition_list_actions';
|
||||||
|
|
||||||
@ -29,8 +28,10 @@ import { setDocumentTitle } from '../../../../../../utils/dom_utils';
|
|||||||
import { mergeOptions } from '../../../../../../utils/general_utils';
|
import { mergeOptions } from '../../../../../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let IkonotvPieceContainer = React.createClass({
|
const IkonotvPieceContainer = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
// Provided from WalletApp
|
// Provided from WalletApp
|
||||||
currentUser: React.PropTypes.object,
|
currentUser: React.PropTypes.object,
|
||||||
whitelabel: React.PropTypes.object,
|
whitelabel: React.PropTypes.object,
|
||||||
@ -40,10 +41,6 @@ let IkonotvPieceContainer = React.createClass({
|
|||||||
params: React.PropTypes.object
|
params: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
PieceListStore.getState(),
|
PieceListStore.getState(),
|
||||||
@ -92,7 +89,7 @@ let IkonotvPieceContainer = React.createClass({
|
|||||||
const notification = new GlobalNotificationModel(response.notification, 'success');
|
const notification = new GlobalNotificationModel(response.notification, 'success');
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -147,4 +144,4 @@ let IkonotvPieceContainer = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default IkonotvPieceContainer;
|
export default withRouter(IkonotvPieceContainer);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
import Moment from 'moment';
|
import Moment from 'moment';
|
||||||
|
|
||||||
import Col from 'react-bootstrap/lib/Col';
|
import Col from 'react-bootstrap/lib/Col';
|
||||||
@ -29,8 +28,10 @@ import { mergeOptions } from '../../../../../utils/general_utils';
|
|||||||
import { getLangText } from '../../../../../utils/lang_utils';
|
import { getLangText } from '../../../../../utils/lang_utils';
|
||||||
|
|
||||||
|
|
||||||
let IkonotvRegisterPiece = React.createClass({
|
const IkonotvRegisterPiece = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
handleSuccess: React.PropTypes.func,
|
handleSuccess: React.PropTypes.func,
|
||||||
|
|
||||||
// Provided from WalletApp
|
// Provided from WalletApp
|
||||||
@ -41,10 +42,6 @@ let IkonotvRegisterPiece = React.createClass({
|
|||||||
location: React.PropTypes.object
|
location: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
PieceListStore.getState(),
|
PieceListStore.getState(),
|
||||||
@ -93,7 +90,7 @@ let IkonotvRegisterPiece = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.canSubmit()) {
|
if (!this.canSubmit()) {
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
} else {
|
} else {
|
||||||
this.nextSlide({ piece_id: response.piece.id });
|
this.nextSlide({ piece_id: response.piece.id });
|
||||||
}
|
}
|
||||||
@ -118,7 +115,7 @@ let IkonotvRegisterPiece = React.createClass({
|
|||||||
|
|
||||||
this.refreshPieceList();
|
this.refreshPieceList();
|
||||||
|
|
||||||
this.context.router.push(`/pieces/${this.state.piece.id}`);
|
this.props.router.push(`/pieces/${this.state.piece.id}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
nextSlide(queryParams) {
|
nextSlide(queryParams) {
|
||||||
@ -246,4 +243,4 @@ let IkonotvRegisterPiece = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default IkonotvRegisterPiece;
|
export default withRouter(IkonotvRegisterPiece);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
|
|
||||||
import Col from 'react-bootstrap/lib/Col';
|
import Col from 'react-bootstrap/lib/Col';
|
||||||
import Row from 'react-bootstrap/lib/Row';
|
import Row from 'react-bootstrap/lib/Row';
|
||||||
@ -24,6 +23,8 @@ import { mergeOptions } from '../../../../../utils/general_utils';
|
|||||||
|
|
||||||
let MarketRegisterPiece = React.createClass({
|
let MarketRegisterPiece = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
// Provided from WalletApp
|
// Provided from WalletApp
|
||||||
currentUser: React.PropTypes.object,
|
currentUser: React.PropTypes.object,
|
||||||
whitelabel: React.PropTypes.object.isRequired,
|
whitelabel: React.PropTypes.object.isRequired,
|
||||||
@ -32,10 +33,6 @@ let MarketRegisterPiece = React.createClass({
|
|||||||
location: React.PropTypes.object
|
location: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object.isRequired
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState(){
|
getInitialState(){
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
PieceListStore.getState(),
|
PieceListStore.getState(),
|
||||||
@ -83,7 +80,7 @@ let MarketRegisterPiece = React.createClass({
|
|||||||
handleAdditionalDataSuccess() {
|
handleAdditionalDataSuccess() {
|
||||||
this.refreshPieceList();
|
this.refreshPieceList();
|
||||||
|
|
||||||
this.context.router.push('/collection');
|
this.props.router.push('/collection');
|
||||||
},
|
},
|
||||||
|
|
||||||
nextSlide(queryParams) {
|
nextSlide(queryParams) {
|
||||||
@ -161,4 +158,4 @@ let MarketRegisterPiece = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default MarketRegisterPiece;
|
export default withRouter(MarketRegisterPiece);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import withRouter from 'react-router/es6/withRouter';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import AppBase from '../../app_base';
|
import AppBase from '../../app_base';
|
||||||
@ -14,6 +13,7 @@ let WalletApp = React.createClass({
|
|||||||
propTypes: {
|
propTypes: {
|
||||||
activeRoute: React.PropTypes.object.isRequired,
|
activeRoute: React.PropTypes.object.isRequired,
|
||||||
children: React.PropTypes.element.isRequired,
|
children: React.PropTypes.element.isRequired,
|
||||||
|
router: React.PropTypes.object.isRequired,
|
||||||
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
|
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
|
||||||
|
|
||||||
// Provided from AppBase
|
// Provided from AppBase
|
||||||
@ -21,13 +21,8 @@ let WalletApp = React.createClass({
|
|||||||
whitelabel: React.PropTypes.object
|
whitelabel: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
|
||||||
router: React.PropTypes.object
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { activeRoute, children, currentUser, routes, whitelabel } = this.props;
|
const { activeRoute, children, currentUser, router, routes, whitelabel } = this.props;
|
||||||
const { router } = this.context;
|
|
||||||
const subdomain = getSubdomain();
|
const subdomain = getSubdomain();
|
||||||
const path = activeRoute && activeRoute.path;
|
const path = activeRoute && activeRoute.path;
|
||||||
const Footer = activeRoute && activeRoute.footer;
|
const Footer = activeRoute && activeRoute.footer;
|
||||||
@ -63,4 +58,4 @@ let WalletApp = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default AppBase(WalletApp);
|
export default AppBase(withRouter(WalletApp));
|
||||||
|
Loading…
Reference in New Issue
Block a user