summaryrefslogtreecommitdiffstats
path: root/web/react/components/command_list.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-07-22 19:19:27 -0800
committerCorey Hulen <corey@hulen.com>2015-07-22 19:19:27 -0800
commitdc79707787b521ea5fc0d9088ccd9069780c8e0c (patch)
tree2f37a2aa6aa897fac5c5045d513eb1a69c818f6e /web/react/components/command_list.jsx
parent37c8193dceb37dc6bd2d38b50fdbe0b4647bff2f (diff)
parent8476062d214230e2370af87a9495457c7a5a2a6d (diff)
downloadchat-dc79707787b521ea5fc0d9088ccd9069780c8e0c.tar.gz
chat-dc79707787b521ea5fc0d9088ccd9069780c8e0c.tar.bz2
chat-dc79707787b521ea5fc0d9088ccd9069780c8e0c.zip
Merge pull request #194 from ralder/fix-command-box-css
[webui] fix command-list css
Diffstat (limited to 'web/react/components/command_list.jsx')
-rw-r--r--web/react/components/command_list.jsx17
1 files changed, 7 insertions, 10 deletions
diff --git a/web/react/components/command_list.jsx b/web/react/components/command_list.jsx
index 023f5f760..5efe98dc6 100644
--- a/web/react/components/command_list.jsx
+++ b/web/react/components/command_list.jsx
@@ -20,12 +20,7 @@ module.exports = React.createClass({
},
getSuggestedCommands: function(cmd) {
- if (cmd == "") {
- this.setState({ suggestions: [ ], cmd: "" });
- return;
- }
-
- if (cmd.indexOf("/") != 0) {
+ if (!cmd || cmd.charAt(0) != '/') {
this.setState({ suggestions: [ ], cmd: "" });
return;
}
@@ -35,17 +30,19 @@ module.exports = React.createClass({
cmd,
true,
function(data) {
- if (data.suggestions.length === 1 && data.suggestions[0].suggestion === cmd) data.suggestions = [];
+ if (data.suggestions.length === 1 && data.suggestions[0].suggestion === cmd) {
+ data.suggestions = [];
+ }
this.setState({ suggestions: data.suggestions, cmd: cmd });
}.bind(this),
function(err){
- }.bind(this)
+ }
);
},
render: function() {
if (this.state.suggestions.length == 0) return (<div/>);
- var suggestions = []
+ var suggestions = [];
for (var i = 0; i < this.state.suggestions.length; i++) {
if (this.state.suggestions[i].suggestion != this.state.cmd) {
@@ -59,7 +56,7 @@ module.exports = React.createClass({
}
return (
- <div ref="mentionlist" className="command-box" style={{height:(this.state.suggestions*37)+2}}>
+ <div ref="mentionlist" className="command-box" style={{height:(this.state.suggestions.length*37)+2}}>
{ suggestions }
</div>
);