Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2017-01-31 12:14:01 +0300
committerKushal Pandya <kushal@gitlab.com>2017-02-07 18:42:00 +0300
commite665ea050a9fcdb69a8d40db4ed120fe35bb0b97 (patch)
tree6631eef951202a93a120335db13d245cf548b486 /app
parentff4950b76c1643120c91ca12ee7187b3131f1010 (diff)
Add Ctrl+Click support
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/todos.js.es621
1 files changed, 18 insertions, 3 deletions
diff --git a/app/assets/javascripts/todos.js.es6 b/app/assets/javascripts/todos.js.es6
index 96c7d927509..bf84d82af97 100644
--- a/app/assets/javascripts/todos.js.es6
+++ b/app/assets/javascripts/todos.js.es6
@@ -147,13 +147,28 @@
goToTodoUrl(e) {
const todoLink = $(this).data('url');
+ let targetLink = $(e.target).attr('href');
+
+ if ($(e.target).is('img')) { // See if clicked target was Avatar
+ targetLink = $(e.target).parent().attr('href'); // Parent of Avatar is link
+ }
+
if (!todoLink) {
return;
}
- // Allow Meta-Click or Mouse3-click to open in a new tab
- if (e.metaKey || e.which === 2) {
+
+ // Allow Meta-Click (Cmd+Click or Ctrl+Click)
+ // or Mouse3-click (middle-click)
+ // to open in a new tab
+ if (e.metaKey || e.ctrlKey || e.which === 2) {
e.preventDefault();
- return window.open(todoLink, '_blank');
+ // Meta-Click on username leads to different URL than todoLink.
+ // Turbolinks can resolve that URL, but window.open requires URL manually.
+ if (targetLink !== todoLink) {
+ return window.open(targetLink, '_blank');
+ } else {
+ return window.open(todoLink, '_blank');
+ }
} else {
return gl.utils.visitUrl(todoLink);
}