mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +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;
|
let navRoutesLinks;
|
||||||
if (this.state.currentUser.username){
|
if (this.state.currentUser.username){
|
||||||
account = (
|
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>
|
<MenuItemLink eventKey="2" to="settings">{getLangText('Account Settings')}</MenuItemLink>
|
||||||
<MenuItem divider />
|
<MenuItem divider />
|
||||||
<MenuItemLink eventKey="3" to="logout">{getLangText('Log out')}</MenuItemLink>
|
<MenuItemLink eventKey="3" to="logout">{getLangText('Log out')}</MenuItemLink>
|
||||||
|
@ -36,6 +36,27 @@ let HeaderNotifications = React.createClass({
|
|||||||
this.setState(state);
|
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() {
|
render() {
|
||||||
if (this.state.requestActions && this.state.requestActions.length > 0) {
|
if (this.state.requestActions && this.state.requestActions.length > 0) {
|
||||||
return (
|
return (
|
||||||
@ -48,7 +69,8 @@ let HeaderNotifications = React.createClass({
|
|||||||
<span className="notification-amount">({this.state.requestActions.length})</span>
|
<span className="notification-amount">({this.state.requestActions.length})</span>
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
className="notification-menu">
|
className="notification-menu"
|
||||||
|
onSelect={this.onSelected}>
|
||||||
{this.state.requestActions.map((pieceOrEdition, i) => {
|
{this.state.requestActions.map((pieceOrEdition, i) => {
|
||||||
return (
|
return (
|
||||||
<MenuItem eventKey={i + 2}>
|
<MenuItem eventKey={i + 2}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user