From 3d4f524dcb7bc8c3fb10daaf49d1dd8504967706 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 Dec 2011 08:59:14 +0200 Subject: play with tree view --- app/assets/images/ajax-loader-tree.gif | Bin 0 -> 2608 bytes app/assets/javascripts/tree.js | 12 +++++++++--- app/assets/stylesheets/projects.css.scss | 7 +++++++ app/views/refs/tree.js.haml | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 app/assets/images/ajax-loader-tree.gif diff --git a/app/assets/images/ajax-loader-tree.gif b/app/assets/images/ajax-loader-tree.gif new file mode 100644 index 00000000000..c69e937232b Binary files /dev/null and b/app/assets/images/ajax-loader-tree.gif differ diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js index 6edd7e49c5a..bde543f0b86 100644 --- a/app/assets/javascripts/tree.js +++ b/app/assets/javascripts/tree.js @@ -5,17 +5,23 @@ var Tree = { init: function() { + (new Image).src = "/assets/ajax-loader-tree.gif"; + $('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() { history.pushState({ path: this.path }, '', this.href) + $("#tree-content-holder").hide("slide", { direction: "left" }, 150) }) $("#tree-slider tr.tree-item").live('click', function(e){ if(e.target.nodeName != "A") { - e.stopPropagation(); link = $(this).find("td.tree-item-file-name a"); - link.click(); - return false; + link.trigger("click"); } }); + + $('#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")} + }); } } diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index 366a0d84a40..828b227a7f0 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -647,3 +647,10 @@ h4.middle-panel { border-radius:3px; float:left; } + +body.project-page h2.icon.loading { + span { + background-position: 0px 0px; + background: url("ajax-loader-tree.gif") no-repeat; + } +} diff --git a/app/views/refs/tree.js.haml b/app/views/refs/tree.js.haml index ef078caa7b2..97bc0b81350 100644 --- a/app/views/refs/tree.js.haml +++ b/app/views/refs/tree.js.haml @@ -1,5 +1,5 @@ :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-content-holder").show("slide", { direction: "right" }, 150); - }); + //}); -- cgit v1.2.1