diff --git a/skins/base/views/organisms/LogoutPrompt.js b/skins/base/views/organisms/LogoutPrompt.js new file mode 100644 index 00000000..dc76032a --- /dev/null +++ b/skins/base/views/organisms/LogoutPrompt.js @@ -0,0 +1,37 @@ +/* +Copyright 2015 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +'use strict'; + +var React = require('react'); + +var LogoutPromptController = require("../../../../src/controllers/organisms/LogoutPrompt"); + +module.exports = React.createClass({ + displayName: 'LogoutPrompt', + mixins: [LogoutPromptController], + + render: function() { + return ( +
+ Sign out?
+ + +
+ ); + }, +}); + diff --git a/skins/base/views/organisms/UserSettings.js b/skins/base/views/organisms/UserSettings.js index 7bc6b0fe..e90953ae 100644 --- a/skins/base/views/organisms/UserSettings.js +++ b/skins/base/views/organisms/UserSettings.js @@ -22,6 +22,7 @@ var UserSettingsController = require("../../../../src/controllers/organisms/User var EditableText = ComponentBroker.get('atoms/EditableText'); var ChangeAvatar = ComponentBroker.get('molecules/ChangeAvatar'); var ChangePassword = ComponentBroker.get('molecules/ChangePassword'); +var LogoutPrompt = ComponentBroker.get('organisms/LogoutPrompt'); var Loader = require("react-loader"); var Modal = require("../../../../src/Modal") @@ -47,6 +48,14 @@ module.exports = React.createClass({ Modal.createDialog(ChangePassword); }, + onLogoutClicked: function(ev) { + this.logoutModal = Modal.createDialog(LogoutPrompt, {onCancel: this.onLogoutPromptCancel}); + }, + + onLogoutPromptCancel: function() { + this.logoutModal.closeDialog(); + }, + render: function() { switch (this.state.phase) { case this.Phases.Loading: @@ -88,6 +97,9 @@ module.exports = React.createClass({
Version {this.state.clientVersion}
+
+ +
diff --git a/src/ComponentBroker.js b/src/ComponentBroker.js index 342a5393..8a7bd663 100644 --- a/src/ComponentBroker.js +++ b/src/ComponentBroker.js @@ -95,6 +95,7 @@ require('../skins/base/views/molecules/ChangePassword'); // new for vector require('../skins/base/views/organisms/LeftPanel'); require('../skins/base/views/organisms/RightPanel'); +require('../skins/base/views/organisms/LogoutPrompt'); require('../skins/base/views/molecules/RoomCreate'); require('../skins/base/views/molecules/RoomDropTarget'); require('../skins/base/views/molecules/DirectoryMenu'); diff --git a/src/controllers/organisms/LogoutPrompt.js b/src/controllers/organisms/LogoutPrompt.js new file mode 100644 index 00000000..8875a55c --- /dev/null +++ b/src/controllers/organisms/LogoutPrompt.js @@ -0,0 +1,35 @@ +/* +Copyright 2015 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +'use strict'; + +var dis = require("../../dispatcher"); + +module.exports = { + logOut: function() { + dis.dispatch({action: 'logout'}); + if (this.props.onFinished) { + this.props.onFinished(); + } + }, + + cancelPrompt: function() { + if (this.props.onFinished) { + this.props.onFinished(); + } + } +}; + diff --git a/src/controllers/organisms/UserSettings.js b/src/controllers/organisms/UserSettings.js index 3f5b980e..4eb1fd59 100644 --- a/src/controllers/organisms/UserSettings.js +++ b/src/controllers/organisms/UserSettings.js @@ -68,5 +68,5 @@ module.exports = { }, function(err) { console.err(err); } ); - }, + } }