diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-07-30 13:01:38 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-07-30 13:01:38 -0400 |
commit | 8265e5ed8215dcf0cf4ca3438f5f2e62576656fe (patch) | |
tree | 21a70622e15d2952af56445fe1a923c4b844c174 /web/react/components/sidebar_header.jsx | |
parent | c09beaa655789ff3b60418af784f2ca75d0c268d (diff) | |
parent | 4b531ef8c4ff1ea34658f5b0b0c15ebc0321a867 (diff) | |
download | chat-8265e5ed8215dcf0cf4ca3438f5f2e62576656fe.tar.gz chat-8265e5ed8215dcf0cf4ca3438f5f2e62576656fe.tar.bz2 chat-8265e5ed8215dcf0cf4ca3438f5f2e62576656fe.zip |
Merge pull request #292 from mattermost/mm-1782
MM-1782 makes the LHS dropdown close when clicking on the LHS header
Diffstat (limited to 'web/react/components/sidebar_header.jsx')
-rw-r--r-- | web/react/components/sidebar_header.jsx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/web/react/components/sidebar_header.jsx b/web/react/components/sidebar_header.jsx index 0156dc01a..e01ddcd05 100644 --- a/web/react/components/sidebar_header.jsx +++ b/web/react/components/sidebar_header.jsx @@ -17,11 +17,20 @@ var NavbarDropdown = React.createClass({ e.preventDefault(); client.logout(); }, + blockToggle: false, componentDidMount: function() { UserStore.addTeamsChangeListener(this._onChange); + + var self = this; + $(this.refs.dropdown.getDOMNode()).on('hide.bs.dropdown', function(e) { + self.blockToggle = true; + setTimeout(function(){self.blockToggle = false;}, 100); + }); }, componentWillUnmount: function() { UserStore.removeTeamsChangeListener(this._onChange); + + $(this.refs.dropdown.getDOMNode()).off('hide.bs.dropdown'); }, _onChange: function() { if (this.isMounted()) { @@ -75,7 +84,7 @@ var NavbarDropdown = React.createClass({ return ( <ul className="nav navbar-nav navbar-right"> - <li className="dropdown"> + <li ref="dropdown" className="dropdown"> <a href="#" className="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <span className="dropdown__icon" dangerouslySetInnerHTML={{__html: Constants.MENU_ICON }} /> </a> @@ -108,7 +117,11 @@ module.exports = React.createClass({ }, toggleDropdown: function(e) { - $('.team__header').find('.dropdown-toggle').trigger('click'); + if (this.refs.dropdown.blockToggle) { + this.refs.dropdown.blockToggle = false; + return; + } + $('.team__header').find('.dropdown-toggle').dropdown('toggle'); }, render: function() { @@ -131,7 +144,7 @@ module.exports = React.createClass({ <div className="team__name">{ this.props.teamDisplayName }</div> </div> </a> - <NavbarDropdown teamType={this.props.teamType} /> + <NavbarDropdown ref="dropdown" teamType={this.props.teamType} /> </div> ); } |