1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

add queryparams modal

This commit is contained in:
Tim Daubenschütz 2015-06-15 15:46:33 +02:00
parent 56d32efcc0
commit 8ceabda1c5
2 changed files with 44 additions and 0 deletions

View 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;

View File

@ -8,6 +8,7 @@ import PieceList from './components/piece_list';
import EditionContainer from './components/edition_container';
import PasswordResetForm from './components/ascribe_forms/form_password_reset';
import AppConstants from './constants/application_constants';
import LoginModalHandler from './components/login_modal_handler';
let Route = Router.Route;
let Redirect = Router.Redirect;
@ -16,6 +17,7 @@ let baseUrl = AppConstants.baseUrl;
let routes = (
<Route name="app" path={baseUrl} handler={AscribeApp}>
<Route name="login" path="*" handler={LoginModalHandler} />
<Route name="pieces" path="collection" handler={PieceList} />
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
<Route name="password_reset" path="password_reset" handler={PasswordResetForm} />