Commit bfaa3edbf185ac1153cdda305246117c45ae622e
1 parent
ebf6821f
Exists in
master
and in
4 other branches
Remove tree history & ajax slider
Showing
2 changed files
with
7 additions
and
45 deletions
Show diff stats
app/assets/javascripts/tree.js.coffee
1 | # Code browser tree slider | 1 | # Code browser tree slider |
2 | +# Make the entire tree-item row clickable, but not if clicking another link (like a commit message) | ||
3 | +$(".tree-content-holder .tree-item").live 'click', (e) -> | ||
4 | + if (e.target.nodeName != "A") | ||
5 | + path = $('.tree-item-file-name a', this).attr('href') | ||
6 | + Turbolinks.visit(path) | ||
2 | 7 | ||
3 | $ -> | 8 | $ -> |
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" }, 400) | ||
10 | - | ||
11 | - # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) | ||
12 | - $("#tree-slider .tree-item").live 'click', (e) -> | ||
13 | - $('.tree-item-file-name a', this).trigger('click') if (e.target.nodeName != "A") | ||
14 | - | ||
15 | - # Maintain forward/back history while browsing the file tree | ||
16 | - ((window) -> | ||
17 | - History = window.History | ||
18 | - $ = window.jQuery | ||
19 | - document = window.document | ||
20 | - | ||
21 | - # Check to see if History.js is enabled for our Browser | ||
22 | - unless History.enabled | ||
23 | - return false | ||
24 | - | ||
25 | - $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) -> | ||
26 | - History.pushState(null, null, decodeURIComponent($(@).attr('href'))) | ||
27 | - return false | ||
28 | - | ||
29 | - History.Adapter.bind window, 'statechange', -> | ||
30 | - state = History.getState() | ||
31 | - $.ajax({ | ||
32 | - url: state.url, | ||
33 | - dataType: 'script', | ||
34 | - beforeSend: -> $('.tree_progress').addClass("loading"), | ||
35 | - complete: -> $('.tree_progress').removeClass("loading") | ||
36 | - }) | ||
37 | - )(window) | 9 | + # Show the "Loading commit data" for only the first element |
10 | + $('span.log_loading:first').removeClass('hide') | ||
38 | 11 | ||
39 | # See if there are lines selected | 12 | # See if there are lines selected |
40 | # "#L12" and "#L34-56" supported | 13 | # "#L12" and "#L34-56" supported |
app/views/tree/show.js.haml
@@ -1,11 +0,0 @@ | @@ -1,11 +0,0 @@ | ||
1 | -:plain | ||
2 | - // Load Files list | ||
3 | - $("#tree-holder").html("#{escape_javascript(render(partial: "tree", locals: {tree: @tree}))}"); | ||
4 | - $("#tree-content-holder").show("slide", { direction: "right" }, 400); | ||
5 | - $('.project-refs-form #path').val("#{@path}"); | ||
6 | - $(".project-refs-form #destination").val("tree"); | ||
7 | - | ||
8 | - // Load last commit log for each file in tree | ||
9 | - $('#tree-slider').waitForImages(function() { | ||
10 | - ajaxGet('#{@logs_path}'); | ||
11 | - }); |