mirror of
https://github.com/ascribe/onion.git
synced 2024-12-31 17:17:48 +01:00
add queryparams modal
This commit is contained in:
parent
56d32efcc0
commit
8ceabda1c5
42
js/components/login_modal_handler.js
Normal file
42
js/components/login_modal_handler.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import Button from 'react-bootstrap/lib/Button';
|
||||||
|
import Modal from 'react-bootstrap/lib/Modal';
|
||||||
|
import OverlayMixin from 'react-bootstrap/lib/OverlayMixin';
|
||||||
|
|
||||||
|
let LoginModalHandler = React.createClass({
|
||||||
|
mixins: [OverlayMixin],
|
||||||
|
|
||||||
|
getInitialState() {
|
||||||
|
return {
|
||||||
|
isModalOpen: true
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
handleToggle() {
|
||||||
|
this.setState({
|
||||||
|
isModalOpen: !this.state.isModalOpen
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
if (!this.state.isModalOpen || !(this.props.query.login === '')) {
|
||||||
|
return <span/>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal title='Modal heading' onRequestHide={this.handleToggle}>
|
||||||
|
<div className='modal-body'>
|
||||||
|
This modal is controlled by our custom trigger component.
|
||||||
|
</div>
|
||||||
|
<div className='modal-footer'>
|
||||||
|
<Button onClick={this.handleToggle}>Close</Button>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default LoginModalHandler;
|
@ -8,6 +8,7 @@ import PieceList from './components/piece_list';
|
|||||||
import EditionContainer from './components/edition_container';
|
import EditionContainer from './components/edition_container';
|
||||||
import PasswordResetForm from './components/ascribe_forms/form_password_reset';
|
import PasswordResetForm from './components/ascribe_forms/form_password_reset';
|
||||||
import AppConstants from './constants/application_constants';
|
import AppConstants from './constants/application_constants';
|
||||||
|
import LoginModalHandler from './components/login_modal_handler';
|
||||||
|
|
||||||
let Route = Router.Route;
|
let Route = Router.Route;
|
||||||
let Redirect = Router.Redirect;
|
let Redirect = Router.Redirect;
|
||||||
@ -16,6 +17,7 @@ let baseUrl = AppConstants.baseUrl;
|
|||||||
|
|
||||||
let routes = (
|
let routes = (
|
||||||
<Route name="app" path={baseUrl} handler={AscribeApp}>
|
<Route name="app" path={baseUrl} handler={AscribeApp}>
|
||||||
|
<Route name="login" path="*" handler={LoginModalHandler} />
|
||||||
<Route name="pieces" path="collection" handler={PieceList} />
|
<Route name="pieces" path="collection" handler={PieceList} />
|
||||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||||
<Route name="password_reset" path="password_reset" handler={PasswordResetForm} />
|
<Route name="password_reset" path="password_reset" handler={PasswordResetForm} />
|
||||||
|
Loading…
Reference in New Issue
Block a user