Commit faf7c79eb2d0c380b692be413953d206f2984b0b
1 parent
4df4b381
Exists in
master
and in
4 other branches
lil js refactoring
Showing
5 changed files
with
26 additions
and
16 deletions
Show diff stats
app/assets/javascripts/merge_requests.js.coffee
app/assets/javascripts/projects.js
| 1 | 1 | $(document).ready(function(){ |
| 2 | - $('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() { | |
| 3 | - history.pushState({ path: this.path }, '', this.href) | |
| 4 | - }) | |
| 5 | - | |
| 6 | - $("#tree-slider tr.tree-item").live('click', function(e){ | |
| 7 | - if(e.target.nodeName != "A") { | |
| 8 | - e.stopPropagation(); | |
| 9 | - link = $(this).find("td.tree-item-file-name a") | |
| 10 | - link.click(); | |
| 11 | - return false; | |
| 12 | - } | |
| 13 | - }); | |
| 14 | - | |
| 15 | 2 | $("#projects-list .project").live('click', function(e){ |
| 16 | 3 | if(e.target.nodeName != "A" && e.target.nodeName != "INPUT") { |
| 17 | 4 | location.href = $(this).attr("url"); | ... | ... |
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +/** | |
| 2 | + * Tree slider for code browse | |
| 3 | + * | |
| 4 | + */ | |
| 5 | +var Tree = { | |
| 6 | + init: | |
| 7 | + function() { | |
| 8 | + $('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() { | |
| 9 | + history.pushState({ path: this.path }, '', this.href) | |
| 10 | + }) | |
| 11 | + | |
| 12 | + $("#tree-slider tr.tree-item").live('click', function(e){ | |
| 13 | + if(e.target.nodeName != "A") { | |
| 14 | + e.stopPropagation(); | |
| 15 | + link = $(this).find("td.tree-item-file-name a"); | |
| 16 | + link.click(); | |
| 17 | + return false; | |
| 18 | + } | |
| 19 | + }); | |
| 20 | + } | |
| 21 | +} | ... | ... |
app/views/refs/tree.html.haml