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,12 +11,7 @@ $ -> | ||
| 11 | # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) | 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) -> | 12 | $("#tree-slider .tree-item").live 'click', (e) -> |
| 13 | $('.tree-item-file-name a', this).trigger('click') if (e.target.nodeName != "A") | 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 | # Maintain forward/back history while browsing the file tree | 15 | # Maintain forward/back history while browsing the file tree |
| 21 | ((window) -> | 16 | ((window) -> |
| 22 | History = window.History | 17 | History = window.History |
| @@ -33,7 +28,12 @@ $ -> | @@ -33,7 +28,12 @@ $ -> | ||
| 33 | 28 | ||
| 34 | History.Adapter.bind window, 'statechange', -> | 29 | History.Adapter.bind window, 'statechange', -> |
| 35 | state = History.getState() | 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 | )(window) | 37 | )(window) |
| 38 | 38 | ||
| 39 | # See if there are lines selected | 39 | # See if there are lines selected |
app/views/tree/_tree.html.haml
| @@ -11,9 +11,6 @@ | @@ -11,9 +11,6 @@ | ||
| 11 | - else | 11 | - else |
| 12 | = link_to title, '#' | 12 | = link_to title, '#' |
| 13 | 13 | ||
| 14 | -.clear | ||
| 15 | -%div.tree_progress | ||
| 16 | - | ||
| 17 | %div#tree-content-holder.tree-content-holder | 14 | %div#tree-content-holder.tree-content-holder |
| 18 | - if tree.is_blob? | 15 | - if tree.is_blob? |
| 19 | = render "tree/blob", blob: tree | 16 | = render "tree/blob", blob: tree |
| @@ -40,6 +37,8 @@ | @@ -40,6 +37,8 @@ | ||
| 40 | - if tree.readme | 37 | - if tree.readme |
| 41 | = render "tree/readme", readme: tree.readme | 38 | = render "tree/readme", readme: tree.readme |
| 42 | 39 | ||
| 40 | +%div.tree_progress | ||
| 41 | + | ||
| 43 | - unless tree.is_blob? | 42 | - unless tree.is_blob? |
| 44 | :javascript | 43 | :javascript |
| 45 | // Load last commit log for each file in tree | 44 | // Load last commit log for each file in tree |