Keep the hash in the location so we can scroll to line in logs

This commit is contained in:
Piotr Sarnacki 2013-02-23 00:21:01 +01:00
parent 729d22c9a4
commit f0ea65b114
2 changed files with 8 additions and 13 deletions

View File

@ -1,5 +1,12 @@
require 'travis/location'
Ember.Router.reopen
location: (if testMode? then Ember.HashLocation.create() else Ember.HistoryLocation.create())
location: (if testMode? then Ember.HashLocation.create() else Travis.Location.create())
handleURL: (url) ->
console.log 'our handle url', url
url = url.replace(/#.*?$/, '')
@_super(url)
Travis.Router.map ->
@resource 'index', path: '/', ->

View File

@ -1,16 +1,4 @@
Travis.Location = Ember.HistoryLocation.extend
onUpdateURL: (callback) ->
guid = Ember.guidFor(this)
Ember.$(window).bind 'popstate.ember-location-'+guid, (e) ->
callback(location.pathname + location.hash)
getURL: ->
location = @get('location')
location.pathname + location.hash
initState: ->
@replaceState(@getURL());
Ember.set(this, 'history', window.history)
Ember.Location.implementations['travis'] = Travis.Location