diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-06-30 00:49:54 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-06-30 15:21:41 -0400 |
commit | aae4444409a6df29ef5689622ccbcc47cae075c4 (patch) | |
tree | bf53c79c133b25c21c2b52de1b948ae1d9fb6e7c | |
parent | d3b282070ed0374b929be64169ace4115f946255 (diff) | |
download | gitlab-ce-aae4444409a6df29ef5689622ccbcc47cae075c4.tar.gz |
Merge branch 'fix_filebrowser_reload' into 'master'
File Browser navigation fixes
Fixes a double request being made when clicking the file name when navigating through file browser and also fixes opening a file in a new tab or when doing ctrl + click.
Closes #19050
**Before**
![navigation-old](/uploads/f9a40c91e430e31beae3a896cffb1c68/navigation-old.gif)
**After**
![navigation](/uploads/dec9b43894c00cc09d80d19c83506530/navigation.gif)
See merge request !4891
(cherry picked from commit b32a6add8fa602eb35648f3f4661df8b98d909cb)
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/assets/javascripts/tree.js.coffee | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index 1046adfd53e..0636c8b0b86 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ v 8.9.4 - Ensure references to private repos aren't shown to logged-out users. - Fixed search field blur not removing focus. !4704 - Resolve "Sub nav isn't showing on file view". !4890 + - 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 diff --git a/app/assets/javascripts/tree.js.coffee b/app/assets/javascripts/tree.js.coffee index de8eebcd0b2..83de584f2d9 100644 --- a/app/assets/javascripts/tree.js.coffee +++ b/app/assets/javascripts/tree.js.coffee @@ -5,9 +5,15 @@ 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") - path = $('.tree-item-file-name a', this).attr('href') - Turbolinks.visit(path) + $clickedEl = $(e.target) + path = $('.tree-item-file-name a', this).attr('href') + + if not $clickedEl.is('a') and not $clickedEl.is('.str-truncated') + 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') |