play with tree view

This commit is contained in:
Dmitriy Zaporozhets 2011-12-20 08:59:14 +02:00
parent 6bdcaccb46
commit 3d4f524dcb
4 changed files with 18 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -5,17 +5,23 @@
var Tree = { var Tree = {
init: init:
function() { function() {
(new Image).src = "/assets/ajax-loader-tree.gif";
$('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() { $('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() {
history.pushState({ path: this.path }, '', this.href) history.pushState({ path: this.path }, '', this.href)
$("#tree-content-holder").hide("slide", { direction: "left" }, 150)
}) })
$("#tree-slider tr.tree-item").live('click', function(e){ $("#tree-slider tr.tree-item").live('click', function(e){
if(e.target.nodeName != "A") { if(e.target.nodeName != "A") {
e.stopPropagation();
link = $(this).find("td.tree-item-file-name a"); link = $(this).find("td.tree-item-file-name a");
link.click(); link.trigger("click");
return false;
} }
}); });
$('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live({
"ajax:beforeSend": function() { $('h2.icon').addClass("loading") },
"ajax:complete": function() { $('h2.icon').removeClass("loading")}
});
} }
} }

View file

@ -647,3 +647,10 @@ h4.middle-panel {
border-radius:3px; border-radius:3px;
float:left; float:left;
} }
body.project-page h2.icon.loading {
span {
background-position: 0px 0px;
background: url("ajax-loader-tree.gif") no-repeat;
}
}

View file

@ -1,5 +1,5 @@
:plain :plain
$("#tree-content-holder").hide("slide", { direction: "left" }, 150, function(){ //$("#tree-content-holder").hide("slide", { direction: "left" }, 150, function(){
$("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}"); $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}");
$("#tree-content-holder").show("slide", { direction: "right" }, 150); $("#tree-content-holder").show("slide", { direction: "right" }, 150);
}); //});