Merge pull request #824 from mlorb/ml-sci-1700

Fixes closing of notification modal window [SCI-1700]
This commit is contained in:
mlorb 2017-10-18 15:01:59 +02:00 committed by GitHub
commit a7ebaaed87

View file

@ -13,9 +13,7 @@ import {
WILD_SAND_COLOR, WILD_SAND_COLOR,
MYSTIC_COLOR MYSTIC_COLOR
} from "../../../config/constants/colors"; } from "../../../config/constants/colors";
import { import { SETTINGS_ACCOUNT_PREFERENCES } from "../../../config/routes";
SETTINGS_ACCOUNT_PREFERENCES
} from "../../../config/routes"
import NotificationItem from "./NotificationItem"; import NotificationItem from "./NotificationItem";
import Spinner from "../../Spinner"; import Spinner from "../../Spinner";
@ -76,6 +74,7 @@ class NotificationsDropdown extends Component {
this.renderNotifications = this.renderNotifications.bind(this); this.renderNotifications = this.renderNotifications.bind(this);
this.renderNotificationStatus = this.renderNotificationStatus.bind(this); this.renderNotificationStatus = this.renderNotificationStatus.bind(this);
this.loadStatus = this.loadStatus.bind(this); this.loadStatus = this.loadStatus.bind(this);
this.closeDropdown = this.closeDropdown.bind(this);
} }
componentWillMount() { componentWillMount() {
@ -104,6 +103,10 @@ class NotificationsDropdown extends Component {
}); });
} }
closeDropdown() {
this.dropdown.click();
}
renderNotifications() { renderNotifications() {
const list = this.state.notifications.map(notification => ( const list = this.state.notifications.map(notification => (
<NotificationItem key={notification.id} notification={notification} /> <NotificationItem key={notification.id} notification={notification} />
@ -133,7 +136,11 @@ class NotificationsDropdown extends Component {
noCaret noCaret
id="notifications-dropdown" id="notifications-dropdown"
title={ title={
<span> <span
ref={el => {
this.dropdown = el;
}}
>
<i className="fa fa-bell" />&nbsp; <i className="fa fa-bell" />&nbsp;
<span className="visible-xs-inline visible-sm-inline"> <span className="visible-xs-inline visible-sm-inline">
<FormattedMessage id="navbar.notifications_label" /> <FormattedMessage id="navbar.notifications_label" />
@ -148,7 +155,10 @@ class NotificationsDropdown extends Component {
<FormattedMessage id="notifications.dropdown_title" /> <FormattedMessage id="notifications.dropdown_title" />
</span> </span>
<span className="pull-right"> <span className="pull-right">
<Link to={SETTINGS_ACCOUNT_PREFERENCES}> <Link
to={SETTINGS_ACCOUNT_PREFERENCES}
onClick={this.closeDropdown}
>
<FormattedMessage id="notifications.dropdown_settings_link" /> <FormattedMessage id="notifications.dropdown_settings_link" />
</Link> </Link>
</span> </span>