summaryrefslogtreecommitdiffstats
path: root/web/react/stores
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-11-19 08:08:28 -0500
committerChristopher Speller <crspeller@gmail.com>2015-11-19 08:08:28 -0500
commit5f848b74793f679772473a3b5b2ab247bcc927a9 (patch)
tree1d53e4c9dd6351e7a56c0f67dcf3bac4c38a8369 /web/react/stores
parent0dbbdaa45e639d508a4e75933a42ac4c313202d2 (diff)
parent70c957d4546016ff2d981d4e1704699b008d1ca5 (diff)
downloadchat-5f848b74793f679772473a3b5b2ab247bcc927a9.tar.gz
chat-5f848b74793f679772473a3b5b2ab247bcc927a9.tar.bz2
chat-5f848b74793f679772473a3b5b2ab247bcc927a9.zip
Merge pull request #1457 from hmhealey/plt729
PLT-729 Added search button to mobile header
Diffstat (limited to 'web/react/stores')
-rw-r--r--web/react/stores/search_store.jsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/web/react/stores/search_store.jsx b/web/react/stores/search_store.jsx
index 95f0ea845..93b89035c 100644
--- a/web/react/stores/search_store.jsx
+++ b/web/react/stores/search_store.jsx
@@ -14,6 +14,7 @@ var SEARCH_CHANGE_EVENT = 'search_change';
var SEARCH_TERM_CHANGE_EVENT = 'search_term_change';
var MENTION_DATA_CHANGE_EVENT = 'mention_data_change';
var ADD_MENTION_EVENT = 'add_mention';
+var SHOW_SEARCH_EVENT = 'show_search';
class SearchStoreClass extends EventEmitter {
constructor() {
@@ -35,6 +36,10 @@ class SearchStoreClass extends EventEmitter {
this.addMentionDataChangeListener = this.addMentionDataChangeListener.bind(this);
this.removeMentionDataChangeListener = this.removeMentionDataChangeListener.bind(this);
+ this.emitShowSearch = this.emitShowSearch.bind(this);
+ this.addShowSearchListener = this.addShowSearchListener.bind(this);
+ this.removeShowSearchListener = this.removeShowSearchListener.bind(this);
+
this.getSearchResults = this.getSearchResults.bind(this);
this.getIsMentionSearch = this.getIsMentionSearch.bind(this);
@@ -80,6 +85,18 @@ class SearchStoreClass extends EventEmitter {
this.removeListener(SEARCH_TERM_CHANGE_EVENT, callback);
}
+ emitShowSearch() {
+ this.emit(SHOW_SEARCH_EVENT);
+ }
+
+ addShowSearchListener(callback) {
+ this.on(SHOW_SEARCH_EVENT, callback);
+ }
+
+ removeShowSearchListener(callback) {
+ this.removeListener(SHOW_SEARCH_EVENT, callback);
+ }
+
getSearchResults() {
return BrowserStore.getItem('search_results');
}
@@ -146,6 +163,9 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => {
case ActionTypes.RECIEVED_ADD_MENTION:
SearchStore.emitAddMention(action.id, action.username);
break;
+ case ActionTypes.SHOW_SEARCH:
+ SearchStore.emitShowSearch();
+ break;
default:
}
});