diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-08-20 12:19:19 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-08-20 13:17:18 +0200 |
commit | 5cdb8ad0df5e573d8e040e1dbea833a26f50ef74 (patch) | |
tree | f5efc72f5aff812e09c5d491f138c5a7fabec308 /server/sonar-web/src/main/js/apps/nav/global | |
parent | bdbaf099bbc788427899504472319cd8c42e6085 (diff) | |
download | sonarqube-5cdb8ad0df5e573d8e040e1dbea833a26f50ef74.tar.gz sonarqube-5cdb8ad0df5e573d8e040e1dbea833a26f50ef74.zip |
rewrite settings navigation
Diffstat (limited to 'server/sonar-web/src/main/js/apps/nav/global')
-rw-r--r-- | server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx | 7 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx | 17 |
2 files changed, 18 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx index 037b0231210..6249b8b11fb 100644 --- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx +++ b/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx @@ -1,17 +1,14 @@ import React from 'react'; import DashboardNameMixin from '../dashboard-name-mixin'; +import LinksMixin from '../links-mixin'; export default React.createClass({ - mixins: [DashboardNameMixin], + mixins: [DashboardNameMixin, LinksMixin], getDefaultProps: function () { return { globalDashboards: [], globalPages: [] }; }, - activeLink(url) { - return window.location.pathname.indexOf(window.baseUrl + url) === 0 ? 'active' : null; - }, - renderDashboardLink(dashboard) { const url = `${window.baseUrl}/dashboard/index?did=${encodeURIComponent(dashboard.key)}`; const name = this.getLocalizedDashboardName(dashboard.name); diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx index b7d8782268a..908033c73bf 100644 --- a/server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx +++ b/server/sonar-web/src/main/js/apps/nav/global/global-nav.jsx @@ -14,6 +14,11 @@ export default React.createClass({ componentDidMount() { this.loadGlobalNavDetails(); + window.addEventListener('keypress', this.onKeyPress); + }, + + componentWillUnmount() { + window.removeEventListener('keypress', this.onKeyPress); }, loadGlobalNavDetails() { @@ -22,8 +27,18 @@ export default React.createClass({ }); }, + onKeyPress(e) { + var tagName = e.target.tagName; + if (tagName !== 'INPUT' && tagName !== 'SELECT' && tagName !== 'TEXTAREA') { + var code = e.keyCode || e.which; + if (code === 63) { + this.openHelp(); + } + } + }, + openHelp(e) { - e.preventDefault(); + e && e.preventDefault(); new ShortcutsHelpView().render(); }, |