Commit badb092a2d7e90ccf5358f1e8e6af9c9592351c4
1 parent
57e6777b
Exists in
master
and in
4 other branches
Don't initialize Tree History unless tree-slider is present
This was breaking breadcrumb links on non-Tree pages
Showing
1 changed file
with
18 additions
and
20 deletions
Show diff stats
app/assets/javascripts/tree.js.coffee
| ... | ... | @@ -17,23 +17,21 @@ $ -> |
| 17 | 17 | "ajax:beforeSend": -> $('.tree_progress').addClass("loading") |
| 18 | 18 | "ajax:complete": -> $('.tree_progress').removeClass("loading") |
| 19 | 19 | |
| 20 | -# Maintain forward/back history while browsing the file tree | |
| 21 | - | |
| 22 | -((window) -> | |
| 23 | - History = window.History | |
| 24 | - $ = window.jQuery | |
| 25 | - document = window.document | |
| 26 | - | |
| 27 | - # Check to see if History.js is enabled for our Browser | |
| 28 | - unless History.enabled | |
| 29 | - return false | |
| 30 | - | |
| 31 | - $ -> | |
| 32 | - $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) -> | |
| 33 | - History.pushState(null, null, $(@).attr('href')) | |
| 34 | - return false | |
| 35 | - | |
| 36 | - History.Adapter.bind window, 'statechange', -> | |
| 37 | - state = History.getState() | |
| 38 | - window.ajaxGet(state.url) | |
| 39 | -)(window) | |
| 20 | + # Maintain forward/back history while browsing the file tree | |
| 21 | + ((window) -> | |
| 22 | + History = window.History | |
| 23 | + $ = window.jQuery | |
| 24 | + document = window.document | |
| 25 | + | |
| 26 | + # Check to see if History.js is enabled for our Browser | |
| 27 | + unless History.enabled | |
| 28 | + return false | |
| 29 | + | |
| 30 | + $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) -> | |
| 31 | + History.pushState(null, null, $(@).attr('href')) | |
| 32 | + return false | |
| 33 | + | |
| 34 | + History.Adapter.bind window, 'statechange', -> | |
| 35 | + state = History.getState() | |
| 36 | + window.ajaxGet(state.url) | |
| 37 | + )(window) | ... | ... |