1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

Merge branch 'master' of bitbucket.org:ascribe/onion

This commit is contained in:
Tim Daubenschütz 2015-07-17 18:33:33 +02:00
commit 28f875e90c
4 changed files with 38 additions and 12 deletions

View File

@ -10,8 +10,6 @@ import UserStore from '../stores/user_store';
import WhitelabelActions from '../actions/whitelabel_actions';
import WhitelabelStore from '../stores/whitelabel_store';
import Alt from '../alt';
import Nav from 'react-bootstrap/lib/Nav';
import Navbar from 'react-bootstrap/lib/Navbar';
import CollapsibleNav from 'react-bootstrap/lib/CollapsibleNav';
@ -32,7 +30,7 @@ let Header = React.createClass({
showAddWork: React.PropTypes.bool
},
mixins: [Router.Navigation, Router.State],
mixins: [Router.State],
getDefaultProps() {
return {
@ -56,14 +54,6 @@ let Header = React.createClass({
WhitelabelStore.unlisten(this.onChange);
},
handleLogout(){
UserActions.logoutCurrentUser();
Alt.flush();
// kill intercom (with fire)
window.Intercom('shutdown');
this.transitionTo('login');
},
getLogo(){
let logo = (
<span>
@ -120,7 +110,7 @@ let Header = React.createClass({
<DropdownButton eventKey="1" title={this.state.currentUser.username}>
<MenuItemLink eventKey="2" to="settings">{getLangText('Account Settings')}</MenuItemLink>
<MenuItem divider />
<MenuItem eventKey="3" onClick={this.handleLogout}>{getLangText('Log out')}</MenuItem>
<MenuItemLink eventKey="3" to="logout">{getLangText('Log out')}</MenuItemLink>
</DropdownButton>
);

View File

@ -0,0 +1,32 @@
'use strict';
import React from 'react';
import Router from 'react-router';
let Link = Router.Link;
import UserActions from '../actions/user_actions';
import Alt from '../alt';
import AppConstants from '../constants/application_constants';
let baseUrl = AppConstants.baseUrl;
let LogoutContainer = React.createClass({
mixins: [Router.Navigation, Router.State],
componentDidMount() {
UserActions.logoutCurrentUser();
Alt.flush();
// kill intercom (with fire)
window.Intercom('shutdown');
this.transitionTo(baseUrl);
},
render() {
return null;
}
});
export default LogoutContainer;

View File

@ -5,6 +5,7 @@ import Router from 'react-router';
import Landing from './components/landing';
import LoginContainer from './components/login_container';
import LogoutContainer from '../../../components/logout_container';
import SignupContainer from './components/signup_container';
import PasswordResetContainer from '../../../components/password_reset_container';
import PrizeRegisterPiece from './components/register_piece';
@ -25,6 +26,7 @@ function getRoutes(commonRoutes) {
<Route name="app" path={baseUrl} handler={App}>
<Route name="landing" path={baseUrl} handler={Landing} />
<Route name="login" path="login" handler={LoginContainer} />
<Route name="logout" path="logout" handler={LogoutContainer} />
<Route name="signup" path="signup" handler={SignupContainer} />
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
<Route name="register_piece" path="register_piece" handler={PrizeRegisterPiece} />

View File

@ -11,6 +11,7 @@ import PieceContainer from './components/ascribe_detail/piece_container';
import EditionContainer from './components/ascribe_detail/edition_container';
import LoginContainer from './components/login_container';
import LogoutContainer from './components/logout_container';
import SignupContainer from './components/signup_container';
import PasswordResetContainer from './components/password_reset_container';
@ -26,6 +27,7 @@ const COMMON_ROUTES = (
<Route>
<Route name="signup" path="signup" handler={SignupContainer} />
<Route name="login" path="login" handler={LoginContainer} />
<Route name="logout" path="logout" handler={LogoutContainer} />
<Route name="pieces" path="collection" handler={PieceList} />
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />