Commit b5328879f5c0131721a3cd71969f7579376d8498
1 parent
c626ec37
Exists in
master
and in
4 other branches
Rename tree.js to tree.js.coffee
Showing
2 changed files
with
20 additions
and
30 deletions
Show diff stats
app/assets/javascripts/tree.js
@@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
1 | -/** | ||
2 | - * Tree slider for code browse | ||
3 | - * | ||
4 | - */ | ||
5 | -var Tree = { | ||
6 | - init: | ||
7 | - function() { | ||
8 | - $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live("click", function() { | ||
9 | - $("#tree-content-holder").hide("slide", { direction: "left" }, 150) | ||
10 | - }) | ||
11 | - | ||
12 | - $('.project-refs-form').live({ | ||
13 | - "ajax:beforeSend": function() { | ||
14 | - $("#tree-content-holder").hide("slide", { direction: "left" }, 150); | ||
15 | - } | ||
16 | - }) | ||
17 | - | ||
18 | - $("#tree-slider .tree-item").live('click', function(e){ | ||
19 | - if(e.target.nodeName != "A") { | ||
20 | - link = $(this).find(".tree-item-file-name a"); | ||
21 | - link.trigger("click"); | ||
22 | - } | ||
23 | - }); | ||
24 | - | ||
25 | - $('#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form').live({ | ||
26 | - "ajax:beforeSend": function() { $('.tree_progress').addClass("loading"); }, | ||
27 | - "ajax:complete": function() { $('.tree_progress').removeClass("loading"); } | ||
28 | - }); | ||
29 | - } | ||
30 | -} |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +# Code browser tree slider | ||
2 | + | ||
3 | +$ -> | ||
4 | + if $('#tree-slider').length > 0 | ||
5 | + # Show the "Loading commit data" for only the first element | ||
6 | + $('span.log_loading:first').removeClass('hide') | ||
7 | + | ||
8 | + $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live "click", -> | ||
9 | + $("#tree-content-holder").hide("slide", { direction: "left" }, 150) | ||
10 | + | ||
11 | + $('.project-refs-form').live | ||
12 | + "ajax:beforeSend": -> $("#tree-content-holder").hide("slide", { direction: "left" }, 150) | ||
13 | + | ||
14 | + # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) | ||
15 | + $("#tree-slider .tree-item").live 'click', (e) -> | ||
16 | + $('.tree-item-file-name a', this).trigger('click') if (e.target.nodeName != "A") | ||
17 | + | ||
18 | + $('#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form').live | ||
19 | + "ajax:beforeSend": -> $('.tree_progress').addClass("loading") | ||
20 | + "ajax:complete": -> $('.tree_progress').removeClass("loading") |