Skip element that is wrapped by a link

This fixes the double request being made to the same URL
This commit is contained in:
Alfredo Sumaran 2016-06-23 18:36:30 -05:00
parent 65187efa5c
commit 6c9f5a50e9
1 changed files with 3 additions and 1 deletions

View File

@ -5,7 +5,9 @@ class @TreeView
# Code browser tree slider # Code browser tree slider
# Make the entire tree-item row clickable, but not if clicking another link (like a commit message) # 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) -> $(".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') path = $('.tree-item-file-name a', this).attr('href')
Turbolinks.visit(path) Turbolinks.visit(path)