From f7f274f5d508dad5060d85fac30ec9a65ab583bb Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 17 Feb 2015 10:38:01 +0100 Subject: [PATCH] Fix search In search there was a check on 'auth' in the view and we no longer inject auth into views. That's why the check needs to be done on the controller. The other thing is that slash breaks the URL currently, so this commit also changes slash in the search phrase into %2F character. --- app/controllers/repos.coffee | 2 +- app/routes/main/search.coffee | 2 +- app/views/repos-list-tabs.coffee | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/repos.coffee b/app/controllers/repos.coffee index 98ee9538..5299869a 100644 --- a/app/controllers/repos.coffee +++ b/app/controllers/repos.coffee @@ -77,7 +77,7 @@ Controller = Ember.ArrayController.extend searchFor: (phrase) -> Ember.run.cancel(@searchLater) if @searchLater @searchLater = Ember.run.later(this, (-> - @transitionTo('main.search', phrase) + @transitionTo('main.search', phrase.replace(/\//g, '%2F')) ), 500) noReposMessage: (-> diff --git a/app/routes/main/search.coffee b/app/routes/main/search.coffee index b2623693..db0e011d 100644 --- a/app/routes/main/search.coffee +++ b/app/routes/main/search.coffee @@ -14,7 +14,7 @@ Route = MainTabRoute.extend @controllerFor('repos').addObserver('firstObject', this, 'currentRepoDidChange') model: (params) -> - params.phrase + params.phrase.replace(/%2F/g, '/') deactivate: -> @_super.apply(this, arguments) diff --git a/app/views/repos-list-tabs.coffee b/app/views/repos-list-tabs.coffee index 7500b450..964f925a 100644 --- a/app/views/repos-list-tabs.coffee +++ b/app/views/repos-list-tabs.coffee @@ -8,7 +8,7 @@ View = Ember.View.extend classRecent: (-> if @get('tab') == 'recent' 'active' - else if @get('tab') == 'search' && @auth.get('signedIn') + else if @get('tab') == 'search' && @get('controller').auth.get('signedIn') 'hidden' ).property('tab')