File tree Expand file tree Collapse file tree
skins/base/views/organisms Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2015 OpenMarket Ltd
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */
16+
17+ 'use strict' ;
18+
19+ var React = require ( 'react' ) ;
20+
21+ var LogoutPromptController = require ( "../../../../src/controllers/organisms/LogoutPrompt" ) ;
22+
23+ module . exports = React . createClass ( {
24+ displayName : 'LogoutPrompt' ,
25+ mixins : [ LogoutPromptController ] ,
26+
27+ render : function ( ) {
28+ return (
29+ < div className = "mx_LogoutPrompt" >
30+ Sign out?< br />
31+ < button onClick = { this . logOut } > Sign Out</ button >
32+ < button onClick = { this . cancelPrompt } > Cancel</ button >
33+ </ div >
34+ ) ;
35+ } ,
36+ } ) ;
37+
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ var UserSettingsController = require("../../../../src/controllers/organisms/User
2222var EditableText = ComponentBroker . get ( 'atoms/EditableText' ) ;
2323var ChangeAvatar = ComponentBroker . get ( 'molecules/ChangeAvatar' ) ;
2424var ChangePassword = ComponentBroker . get ( 'molecules/ChangePassword' ) ;
25+ var LogoutPrompt = ComponentBroker . get ( 'organisms/LogoutPrompt' ) ;
2526var Loader = require ( "react-loader" ) ;
2627
2728var Modal = require ( "../../../../src/Modal" )
@@ -47,6 +48,14 @@ module.exports = React.createClass({
4748 Modal . createDialog ( ChangePassword ) ;
4849 } ,
4950
51+ onLogoutClicked : function ( ev ) {
52+ this . logoutModal = Modal . createDialog ( LogoutPrompt , { onCancel : this . onLogoutPromptCancel } ) ;
53+ } ,
54+
55+ onLogoutPromptCancel : function ( ) {
56+ this . logoutModal . closeDialog ( ) ;
57+ } ,
58+
5059 render : function ( ) {
5160 switch ( this . state . phase ) {
5261 case this . Phases . Loading :
@@ -88,6 +97,9 @@ module.exports = React.createClass({
8897 < div className = "mx_UserSettings_ClientVersion" >
8998 Version { this . state . clientVersion }
9099 </ div >
100+ < div className = "mx_UserSettings_Logout" >
101+ < button onClick = { this . onLogoutClicked } > Sign Out</ button >
102+ </ div >
91103 </ div >
92104 </ div >
93105 </ div >
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ require('../skins/base/views/molecules/ChangePassword');
9595// new for vector
9696require ( '../skins/base/views/organisms/LeftPanel' ) ;
9797require ( '../skins/base/views/organisms/RightPanel' ) ;
98+ require ( '../skins/base/views/organisms/LogoutPrompt' ) ;
9899require ( '../skins/base/views/molecules/RoomCreate' ) ;
99100require ( '../skins/base/views/molecules/RoomDropTarget' ) ;
100101require ( '../skins/base/views/molecules/DirectoryMenu' ) ;
Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2015 OpenMarket Ltd
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */
16+
17+ 'use strict' ;
18+
19+ var dis = require ( "../../dispatcher" ) ;
20+
21+ module . exports = {
22+ logOut : function ( ) {
23+ dis . dispatch ( { action : 'logout' } ) ;
24+ if ( this . props . onFinished ) {
25+ this . props . onFinished ( ) ;
26+ }
27+ } ,
28+
29+ cancelPrompt : function ( ) {
30+ if ( this . props . onFinished ) {
31+ this . props . onFinished ( ) ;
32+ }
33+ }
34+ } ;
35+
Original file line number Diff line number Diff line change @@ -68,5 +68,5 @@ module.exports = {
6868 } ,
6969 function ( err ) { console . err ( err ) ; }
7070 ) ;
71- } ,
71+ }
7272}
You can’t perform that action at this time.
0 commit comments