Don't initialize Tree History unless tree-slider is present

This was breaking breadcrumb links on non-Tree pages
This commit is contained in:
Robert Speicher 2012-11-01 17:57:12 -04:00
parent 57e6777b3c
commit badb092a2d

View file

@ -17,9 +17,8 @@ $ ->
"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) ->
((window) ->
History = window.History History = window.History
$ = window.jQuery $ = window.jQuery
document = window.document document = window.document
@ -28,7 +27,6 @@ $ ->
unless History.enabled unless History.enabled
return false return false
$ ->
$('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) -> $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) ->
History.pushState(null, null, $(@).attr('href')) History.pushState(null, null, $(@).attr('href'))
return false return false
@ -36,4 +34,4 @@ $ ->
History.Adapter.bind window, 'statechange', -> History.Adapter.bind window, 'statechange', ->
state = History.getState() state = History.getState()
window.ajaxGet(state.url) window.ajaxGet(state.url)
)(window) )(window)