mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
close notifications dropdown after click
This commit is contained in:
parent
7919521578
commit
71c438ee59
@ -102,7 +102,9 @@ let Header = React.createClass({
|
||||
let navRoutesLinks;
|
||||
if (this.state.currentUser.username){
|
||||
account = (
|
||||
<DropdownButton eventKey="1" title={this.state.currentUser.username}>
|
||||
<DropdownButton
|
||||
eventKey="1"
|
||||
title={this.state.currentUser.username}>
|
||||
<MenuItemLink eventKey="2" to="settings">{getLangText('Account Settings')}</MenuItemLink>
|
||||
<MenuItem divider />
|
||||
<MenuItemLink eventKey="3" to="logout">{getLangText('Log out')}</MenuItemLink>
|
||||
|
@ -36,6 +36,27 @@ let HeaderNotifications = React.createClass({
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
onSelected(event) {
|
||||
/*
|
||||
This is a hack to make the dropdown close after clicking on an item
|
||||
The function just need to be defined
|
||||
|
||||
from https://github.com/react-bootstrap/react-bootstrap/issues/368:
|
||||
|
||||
@jvillasante - Have you tried to use onSelect with the DropdownButton?
|
||||
I don't have a working example that is exactly like yours,
|
||||
but I just noticed that the Dropdown closes when I've attached an event handler to OnSelect:
|
||||
|
||||
<DropdownButton eventKey={3} title="Admin" onSelect={ this.OnSelected } >
|
||||
|
||||
onSelected: function(e) {
|
||||
// doesn't need to have functionality (necessarily) ... just wired up
|
||||
}
|
||||
Internally, a call to DropdownButton.setDropDownState(false) is made which will hide the dropdown menu.
|
||||
So, you should be able to call that directly on the DropdownButton instance as well if needed.
|
||||
*/
|
||||
},
|
||||
|
||||
render() {
|
||||
if (this.state.requestActions && this.state.requestActions.length > 0) {
|
||||
return (
|
||||
@ -48,7 +69,8 @@ let HeaderNotifications = React.createClass({
|
||||
<span className="notification-amount">({this.state.requestActions.length})</span>
|
||||
</span>
|
||||
}
|
||||
className="notification-menu">
|
||||
className="notification-menu"
|
||||
onSelect={this.onSelected}>
|
||||
{this.state.requestActions.map((pieceOrEdition, i) => {
|
||||
return (
|
||||
<MenuItem eventKey={i + 2}>
|
||||
|
Loading…
Reference in New Issue
Block a user