diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-09 17:02:38 +0200 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-10 11:33:12 +0200 |
commit | 60242a39a5260d73d31d88e11dd6bc7c6b0987c5 (patch) | |
tree | e2757cbc36964ad2af0e147e3fe0872899322e0a /server | |
parent | 10eae4b03f57e7b622fef0606553481f8a5ac812 (diff) | |
download | sonarqube-60242a39a5260d73d31d88e11dd6bc7c6b0987c5.tar.gz sonarqube-60242a39a5260d73d31d88e11dd6bc7c6b0987c5.zip |
SONAR-7998 Open rule description in a new window from rules page
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js | 21 |
2 files changed, 18 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs index 139d46cdcb6..9996447d1bc 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs +++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs @@ -16,7 +16,7 @@ <td> <div class="coding-rule-title"> - <a class="js-rule link-no-underline">{{name}}</a> + <a class="js-rule link-no-underline" href="{{permalink}}">{{name}}</a> </div> </td> diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js index 6235c15c7ab..ec836b95cd2 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js @@ -26,6 +26,7 @@ import RuleFilterMixin from './rule/rule-filter-mixin'; import Template from './templates/coding-rules-workspace-list-item.hbs'; import confirmDialog from './confirm-dialog'; import { translate, translateWithParameters } from '../../helpers/l10n'; +import { getBaseUrl } from '../../helpers/urls'; export default WorkspaceListItemView.extend(RuleFilterMixin).extend({ className: 'coding-rule', @@ -61,9 +62,14 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({ this.options.app.state.set({ selectedIndex: this.model.get('index') }); }, - openRule() { - this.$('[data-toggle="tooltip"]').tooltip('destroy'); - this.options.app.controller.showDetails(this.model); + openRule(event) { + const leftClick = + event.button === 0 && !(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); + if (leftClick) { + event.preventDefault(); + this.$('[data-toggle="tooltip"]').tooltip('destroy'); + this.options.app.controller.showDetails(this.model); + } }, activate() { @@ -121,12 +127,19 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({ const canEditQualityProfile = selectedProfile && selectedProfile.actions && selectedProfile.actions.edit; + const permalinkPath = this.options.app.organization + ? `/organizations/${this.options.app.organization}/rules` + : '/coding_rules'; + const permalink = + getBaseUrl() + permalinkPath + '#rule_key=' + encodeURIComponent(this.model.id); + return { ...WorkspaceListItemView.prototype.serializeData.apply(this, arguments), canEditQualityProfile, tags: union(this.model.get('sysTags'), this.model.get('tags')), selectedProfile: selectedProfileKey, - isSelectedProfileBuiltIn + isSelectedProfileBuiltIn, + permalink }; } }); |