Commit 40f18681948d4662812f342700533c1a99991927
1 parent
e38e2ce2
Exists in
master
and in
4 other branches
Fix loading animation while browsing tree
Showing
2 changed files
with
9 additions
and
10 deletions
Show diff stats
app/assets/javascripts/tree.js.coffee
... | ... | @@ -11,12 +11,7 @@ $ -> |
11 | 11 | # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) |
12 | 12 | $("#tree-slider .tree-item").live 'click', (e) -> |
13 | 13 | $('.tree-item-file-name a', this).trigger('click') if (e.target.nodeName != "A") |
14 | - | |
15 | - # Show/Hide the loading spinner | |
16 | - $('#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form').live | |
17 | - "ajax:beforeSend": -> $('.tree_progress').addClass("loading") | |
18 | - "ajax:complete": -> $('.tree_progress').removeClass("loading") | |
19 | - | |
14 | + | |
20 | 15 | # Maintain forward/back history while browsing the file tree |
21 | 16 | ((window) -> |
22 | 17 | History = window.History |
... | ... | @@ -33,7 +28,12 @@ $ -> |
33 | 28 | |
34 | 29 | History.Adapter.bind window, 'statechange', -> |
35 | 30 | state = History.getState() |
36 | - window.ajaxGet(state.url) | |
31 | + $.ajax({ | |
32 | + url: state.url, | |
33 | + dataType: 'script', | |
34 | + beforeSend: -> $('.tree_progress').addClass("loading"), | |
35 | + complete: -> $('.tree_progress').removeClass("loading") | |
36 | + }) | |
37 | 37 | )(window) |
38 | 38 | |
39 | 39 | # See if there are lines selected | ... | ... |
app/views/tree/_tree.html.haml
... | ... | @@ -11,9 +11,6 @@ |
11 | 11 | - else |
12 | 12 | = link_to title, '#' |
13 | 13 | |
14 | -.clear | |
15 | -%div.tree_progress | |
16 | - | |
17 | 14 | %div#tree-content-holder.tree-content-holder |
18 | 15 | - if tree.is_blob? |
19 | 16 | = render "tree/blob", blob: tree |
... | ... | @@ -40,6 +37,8 @@ |
40 | 37 | - if tree.readme |
41 | 38 | = render "tree/readme", readme: tree.readme |
42 | 39 | |
40 | +%div.tree_progress | |
41 | + | |
43 | 42 | - unless tree.is_blob? |
44 | 43 | :javascript |
45 | 44 | // Load last commit log for each file in tree | ... | ... |