summaryrefslogtreecommitdiffstats
path: root/web/react/stores/modal_store.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-11-04 12:59:41 -0500
committerChristopher Speller <crspeller@gmail.com>2015-11-04 12:59:41 -0500
commitaee6d9b608aceb7b68ab1e1a583917c2c3ee4485 (patch)
tree8908ba8d14cafe8dd1532cc429920b8c243dd465 /web/react/stores/modal_store.jsx
parent2840c317e5a88264aa044261558dda6d91ee1ff3 (diff)
parenta7ceba2e57f5b693afa51b0aefd04081646c6948 (diff)
downloadchat-aee6d9b608aceb7b68ab1e1a583917c2c3ee4485.tar.gz
chat-aee6d9b608aceb7b68ab1e1a583917c2c3ee4485.tar.bz2
chat-aee6d9b608aceb7b68ab1e1a583917c2c3ee4485.zip
Merge pull request #1287 from hmhealey/plt382
PLT-382 Refactored some modals to use React-Bootstrap and added a confirmation when discarding theme changes
Diffstat (limited to 'web/react/stores/modal_store.jsx')
-rw-r--r--web/react/stores/modal_store.jsx42
1 files changed, 42 insertions, 0 deletions
diff --git a/web/react/stores/modal_store.jsx b/web/react/stores/modal_store.jsx
new file mode 100644
index 000000000..dc65d48da
--- /dev/null
+++ b/web/react/stores/modal_store.jsx
@@ -0,0 +1,42 @@
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+const AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
+const EventEmitter = require('events').EventEmitter;
+
+const Constants = require('../utils/constants.jsx');
+const ActionTypes = Constants.ActionTypes;
+
+class ModalStoreClass extends EventEmitter {
+ constructor() {
+ super();
+
+ this.addModalListener = this.addModalListener.bind(this);
+ this.removeModalListener = this.removeModalListener.bind(this);
+
+ this.handleEventPayload = this.handleEventPayload.bind(this);
+ this.dispatchToken = AppDispatcher.register(this.handleEventPayload);
+ }
+
+ addModalListener(action, callback) {
+ this.on(action, callback);
+ }
+
+ removeModalListener(action, callback) {
+ this.removeListener(action, callback);
+ }
+
+ handleEventPayload(payload) {
+ const action = payload.action;
+
+ switch (action.type) {
+ case ActionTypes.TOGGLE_IMPORT_THEME_MODAL:
+ case ActionTypes.TOGGLE_INVITE_MEMBER_MODAL:
+ this.emit(action.type, action.value);
+ break;
+ }
+ }
+}
+
+const ModalStore = new ModalStoreClass();
+export default ModalStore;