diff options
author | Robert Speicher <rspeicher@gmail.com> | 2012-10-04 01:01:16 +0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2012-10-04 03:39:27 +0400 |
commit | b5328879f5c0131721a3cd71969f7579376d8498 (patch) | |
tree | 6a704fb2c6c935f2104beedc6f817b5a8dff4a5e /app/assets | |
parent | c626ec3746f0346a4a90ebf6a0860583b79dd250 (diff) |
Rename tree.js to tree.js.coffee
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/tree.js | 30 | ||||
-rw-r--r-- | app/assets/javascripts/tree.js.coffee | 20 |
2 files changed, 20 insertions, 30 deletions
diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js deleted file mode 100644 index 1c62751ad25..00000000000 --- a/app/assets/javascripts/tree.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Tree slider for code browse - * - */ -var Tree = { - init: - function() { - $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live("click", function() { - $("#tree-content-holder").hide("slide", { direction: "left" }, 150) - }) - - $('.project-refs-form').live({ - "ajax:beforeSend": function() { - $("#tree-content-holder").hide("slide", { direction: "left" }, 150); - } - }) - - $("#tree-slider .tree-item").live('click', function(e){ - if(e.target.nodeName != "A") { - link = $(this).find(".tree-item-file-name a"); - link.trigger("click"); - } - }); - - $('#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form').live({ - "ajax:beforeSend": function() { $('.tree_progress').addClass("loading"); }, - "ajax:complete": function() { $('.tree_progress').removeClass("loading"); } - }); - } -} diff --git a/app/assets/javascripts/tree.js.coffee b/app/assets/javascripts/tree.js.coffee new file mode 100644 index 00000000000..200f1e063e4 --- /dev/null +++ b/app/assets/javascripts/tree.js.coffee @@ -0,0 +1,20 @@ +# Code browser tree slider + +$ -> + if $('#tree-slider').length > 0 + # Show the "Loading commit data" for only the first element + $('span.log_loading:first').removeClass('hide') + + $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live "click", -> + $("#tree-content-holder").hide("slide", { direction: "left" }, 150) + + $('.project-refs-form').live + "ajax:beforeSend": -> $("#tree-content-holder").hide("slide", { direction: "left" }, 150) + + # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) + $("#tree-slider .tree-item").live 'click', (e) -> + $('.tree-item-file-name a', this).trigger('click') if (e.target.nodeName != "A") + + $('#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form').live + "ajax:beforeSend": -> $('.tree_progress').addClass("loading") + "ajax:complete": -> $('.tree_progress').removeClass("loading") |