Don't initialize Tree History unless tree-slider is present
This was breaking breadcrumb links on non-Tree pages
This commit is contained in:
parent
57e6777b3c
commit
badb092a2d
1 changed files with 15 additions and 17 deletions
|
@ -17,23 +17,21 @@ $ ->
|
||||||
"ajax:beforeSend": -> $('.tree_progress').addClass("loading")
|
"ajax:beforeSend": -> $('.tree_progress').addClass("loading")
|
||||||
"ajax:complete": -> $('.tree_progress').removeClass("loading")
|
"ajax:complete": -> $('.tree_progress').removeClass("loading")
|
||||||
|
|
||||||
# Maintain forward/back history while browsing the file tree
|
# Maintain forward/back history while browsing the file tree
|
||||||
|
((window) ->
|
||||||
|
History = window.History
|
||||||
|
$ = window.jQuery
|
||||||
|
document = window.document
|
||||||
|
|
||||||
((window) ->
|
# Check to see if History.js is enabled for our Browser
|
||||||
History = window.History
|
unless History.enabled
|
||||||
$ = window.jQuery
|
return false
|
||||||
document = window.document
|
|
||||||
|
|
||||||
# Check to see if History.js is enabled for our Browser
|
$('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) ->
|
||||||
unless History.enabled
|
History.pushState(null, null, $(@).attr('href'))
|
||||||
return false
|
return false
|
||||||
|
|
||||||
$ ->
|
History.Adapter.bind window, 'statechange', ->
|
||||||
$('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) ->
|
state = History.getState()
|
||||||
History.pushState(null, null, $(@).attr('href'))
|
window.ajaxGet(state.url)
|
||||||
return false
|
)(window)
|
||||||
|
|
||||||
History.Adapter.bind window, 'statechange', ->
|
|
||||||
state = History.getState()
|
|
||||||
window.ajaxGet(state.url)
|
|
||||||
)(window)
|
|
||||||
|
|
Loading…
Reference in a new issue