From f0ea65b114ebdfdb5b7921a4c5ac4d2d2d1a744d Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 23 Feb 2013 00:21:01 +0100 Subject: [PATCH] Keep the hash in the location so we can scroll to line in logs --- assets/scripts/app/routes.coffee | 9 ++++++++- assets/scripts/lib/travis/location.coffee | 12 ------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/assets/scripts/app/routes.coffee b/assets/scripts/app/routes.coffee index 50a11562..cee26400 100644 --- a/assets/scripts/app/routes.coffee +++ b/assets/scripts/app/routes.coffee @@ -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: '/', -> diff --git a/assets/scripts/lib/travis/location.coffee b/assets/scripts/lib/travis/location.coffee index b49de069..034fd83f 100644 --- a/assets/scripts/lib/travis/location.coffee +++ b/assets/scripts/lib/travis/location.coffee @@ -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