From 6c9f5a50e99d60b37512a584d3888f5737675921 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Thu, 23 Jun 2016 18:36:30 -0500 Subject: [PATCH 1/3] Skip element that is wrapped by a link This fixes the double request being made to the same URL --- app/assets/javascripts/tree.js.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/tree.js.coffee b/app/assets/javascripts/tree.js.coffee index de8eebcd0b2..f51cb47b6c9 100644 --- a/app/assets/javascripts/tree.js.coffee +++ b/app/assets/javascripts/tree.js.coffee @@ -5,7 +5,9 @@ class @TreeView # Code browser tree slider # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) $(".tree-content-holder .tree-item").on 'click', (e) -> - if (e.target.nodeName != "A") + $clickedEl = $(e.target) + + if not $clickedEl.is('a') and not $clickedEl.is('.str-truncated') path = $('.tree-item-file-name a', this).attr('href') Turbolinks.visit(path) From 6a626a465c3f9157d2f40b371f141982ebc91caa Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Mon, 27 Jun 2016 11:34:25 -0500 Subject: [PATCH 2/3] Fixes opening files on a new tab with meta key + click or using mouse middle button --- app/assets/javascripts/tree.js.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/tree.js.coffee b/app/assets/javascripts/tree.js.coffee index f51cb47b6c9..83de584f2d9 100644 --- a/app/assets/javascripts/tree.js.coffee +++ b/app/assets/javascripts/tree.js.coffee @@ -6,10 +6,14 @@ class @TreeView # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) $(".tree-content-holder .tree-item").on 'click', (e) -> $clickedEl = $(e.target) + path = $('.tree-item-file-name a', this).attr('href') if not $clickedEl.is('a') and not $clickedEl.is('.str-truncated') - path = $('.tree-item-file-name a', this).attr('href') - Turbolinks.visit(path) + if e.metaKey or e.which is 2 + e.preventDefault() + window.open path, '_blank' + else + Turbolinks.visit path # Show the "Loading commit data" for only the first element $('span.log_loading:first').removeClass('hide') From d17046dbbc0c1212ab61cf1a9e1ea3aca54c9b72 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Mon, 27 Jun 2016 11:48:02 -0500 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 775ea606813..1301a5b5f00 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -23,6 +23,9 @@ v 8.10.0 (unreleased) - Allow [ci skip] to be in any case and allow [skip ci]. !4785 (simon_w) - Add basic system information like memory and disk usage to the admin panel +v 8.9.4 (unreleased) + - Fixes middle click and double request when navigating through the file browser !4891 + v 8.9.3 - Fix encrypted data backwards compatibility after upgrading attr_encrypted gem. !4963 - Fix rendering of commit notes. !4953