PLT-3801 Fix toggle dropdown Main menu (#4014)
Этот коммит содержится в:
@@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import $ from 'jquery';
|
|
||||||
import ReactDOM from 'react-dom';
|
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||||
|
|
||||||
@@ -49,14 +47,6 @@ export default class NavbarDropdown extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
$(ReactDOM.findDOMNode(this.refs.dropdown)).on('hide.bs.dropdown', () => {
|
|
||||||
$('.sidebar--left .dropdown-menu').scrollTop(0);
|
|
||||||
this.blockToggle = true;
|
|
||||||
setTimeout(() => {
|
|
||||||
this.blockToggle = false;
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
TeamStore.addChangeListener(this.onTeamChange);
|
TeamStore.addChangeListener(this.onTeamChange);
|
||||||
document.addEventListener('keydown', this.openAccountSettings);
|
document.addEventListener('keydown', this.openAccountSettings);
|
||||||
}
|
}
|
||||||
@@ -69,7 +59,6 @@ export default class NavbarDropdown extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
$(ReactDOM.findDOMNode(this.refs.dropdown)).off('hide.bs.dropdown');
|
|
||||||
TeamStore.removeChangeListener(this.onTeamChange);
|
TeamStore.removeChangeListener(this.onTeamChange);
|
||||||
document.removeEventListener('keydown', this.openAccountSettings);
|
document.removeEventListener('keydown', this.openAccountSettings);
|
||||||
}
|
}
|
||||||
@@ -363,9 +352,8 @@ export default class NavbarDropdown extends React.Component {
|
|||||||
<a
|
<a
|
||||||
href='#'
|
href='#'
|
||||||
className='dropdown-toggle'
|
className='dropdown-toggle'
|
||||||
data-toggle='dropdown'
|
|
||||||
role='button'
|
role='button'
|
||||||
aria-expanded='false'
|
onClick={this.props.toggleDropdown}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className='dropdown__icon'
|
className='dropdown__icon'
|
||||||
@@ -449,5 +437,6 @@ NavbarDropdown.propTypes = {
|
|||||||
teamType: React.PropTypes.string,
|
teamType: React.PropTypes.string,
|
||||||
teamDisplayName: React.PropTypes.string,
|
teamDisplayName: React.PropTypes.string,
|
||||||
teamName: React.PropTypes.string,
|
teamName: React.PropTypes.string,
|
||||||
currentUser: React.PropTypes.object
|
currentUser: React.PropTypes.object,
|
||||||
|
toggleDropdown: React.PropTypes.function
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import $ from 'jquery';
|
|
||||||
import NavbarDropdown from './navbar_dropdown.jsx';
|
import NavbarDropdown from './navbar_dropdown.jsx';
|
||||||
import 'bootstrap';
|
import 'bootstrap';
|
||||||
|
|
||||||
@@ -49,7 +48,13 @@ export default class SidebarHeader extends React.Component {
|
|||||||
this.refs.dropdown.blockToggle = false;
|
this.refs.dropdown.blockToggle = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('.team__header').find('.dropdown-toggle').dropdown('toggle');
|
const menu = document.querySelector('.team__header .dropdown-toggle');
|
||||||
|
const isOpen = menu.parentElement.classList.toggle('open');
|
||||||
|
menu.setAttribute('aria-expanded', isOpen);
|
||||||
|
|
||||||
|
if (!isOpen) {
|
||||||
|
document.querySelector('.sidebar--left .dropdown-menu').scrollTop = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
var me = this.props.currentUser;
|
var me = this.props.currentUser;
|
||||||
@@ -100,6 +105,7 @@ export default class SidebarHeader extends React.Component {
|
|||||||
teamDisplayName={this.props.teamDisplayName}
|
teamDisplayName={this.props.teamDisplayName}
|
||||||
teamName={this.props.teamName}
|
teamName={this.props.teamName}
|
||||||
currentUser={this.props.currentUser}
|
currentUser={this.props.currentUser}
|
||||||
|
toggleDropdown={this.toggleDropdown}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user