Commit 3d4f524dcb7bc8c3fb10daaf49d1dd8504967706

Authored by Dmitriy Zaporozhets
1 parent 6bdcaccb

play with tree view

app/assets/images/ajax-loader-tree.gif 0 → 100644

2.55 KB

app/assets/javascripts/tree.js
@@ -5,17 +5,23 @@ @@ -5,17 +5,23 @@
5 var Tree = { 5 var Tree = {
6 init: 6 init:
7 function() { 7 function() {
  8 + (new Image).src = "/assets/ajax-loader-tree.gif";
  9 +
8 $('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() { 10 $('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() {
9 history.pushState({ path: this.path }, '', this.href) 11 history.pushState({ path: this.path }, '', this.href)
  12 + $("#tree-content-holder").hide("slide", { direction: "left" }, 150)
10 }) 13 })
11 14
12 $("#tree-slider tr.tree-item").live('click', function(e){ 15 $("#tree-slider tr.tree-item").live('click', function(e){
13 if(e.target.nodeName != "A") { 16 if(e.target.nodeName != "A") {
14 - e.stopPropagation();  
15 link = $(this).find("td.tree-item-file-name a"); 17 link = $(this).find("td.tree-item-file-name a");
16 - link.click();  
17 - return false; 18 + link.trigger("click");
18 } 19 }
19 }); 20 });
  21 +
  22 + $('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live({
  23 + "ajax:beforeSend": function() { $('h2.icon').addClass("loading") },
  24 + "ajax:complete": function() { $('h2.icon').removeClass("loading")}
  25 + });
20 } 26 }
21 } 27 }
app/assets/stylesheets/projects.css.scss
@@ -647,3 +647,10 @@ h4.middle-panel { @@ -647,3 +647,10 @@ h4.middle-panel {
647 border-radius:3px; 647 border-radius:3px;
648 float:left; 648 float:left;
649 } 649 }
  650 +
  651 +body.project-page h2.icon.loading {
  652 + span {
  653 + background-position: 0px 0px;
  654 + background: url("ajax-loader-tree.gif") no-repeat;
  655 + }
  656 +}
app/views/refs/tree.js.haml
1 :plain 1 :plain
2 - $("#tree-content-holder").hide("slide", { direction: "left" }, 150, function(){ 2 + //$("#tree-content-holder").hide("slide", { direction: "left" }, 150, function(){
3 $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}"); 3 $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}");
4 $("#tree-content-holder").show("slide", { direction: "right" }, 150); 4 $("#tree-content-holder").show("slide", { direction: "right" }, 150);
5 - }); 5 + //});