Fix search to work with new way of handling repos tabs
This commit is contained in:
parent
345dacff29
commit
f355bc58f3
|
@ -61,22 +61,20 @@ Travis.ReposController = Ember.ArrayController.extend
|
||||||
[]
|
[]
|
||||||
).property('currentUser.login')
|
).property('currentUser.login')
|
||||||
|
|
||||||
viewSearch: (params) ->
|
viewSearch: (phrase) ->
|
||||||
@set('content', Travis.Repo.search(params.search))
|
@set('search', phrase)
|
||||||
|
@set('content', Travis.Repo.search(phrase))
|
||||||
|
|
||||||
searchObserver: (->
|
searchObserver: (->
|
||||||
search = @get('search')
|
search = @get('search')
|
||||||
if search
|
if search
|
||||||
@searchFor search
|
@searchFor search
|
||||||
else
|
|
||||||
@activate 'recent'
|
|
||||||
'recent'
|
|
||||||
).observes('search')
|
).observes('search')
|
||||||
|
|
||||||
searchFor: (phrase) ->
|
searchFor: (phrase) ->
|
||||||
Ember.run.cancel(@searchLater) if @searchLater
|
Ember.run.cancel(@searchLater) if @searchLater
|
||||||
@searchLater = Ember.run.later(this, (->
|
@searchLater = Ember.run.later(this, (->
|
||||||
@activate 'search', search: phrase
|
@transitionTo('index.search', phrase)
|
||||||
), 500)
|
), 500)
|
||||||
|
|
||||||
noReposMessage: (->
|
noReposMessage: (->
|
||||||
|
|
|
@ -54,6 +54,7 @@ Travis.Router.map ->
|
||||||
@resource 'getting_started'
|
@resource 'getting_started'
|
||||||
@route 'recent'
|
@route 'recent'
|
||||||
@route 'my_repositories'
|
@route 'my_repositories'
|
||||||
|
@route 'search', path: '/search/:phrase'
|
||||||
@resource 'repo', path: '/:owner/:name', ->
|
@resource 'repo', path: '/:owner/:name', ->
|
||||||
@route 'index', path: '/'
|
@route 'index', path: '/'
|
||||||
@resource 'build', path: '/builds/:build_id'
|
@resource 'build', path: '/builds/:build_id'
|
||||||
|
@ -185,6 +186,27 @@ Travis.IndexMyRepositoriesRoute = Travis.IndexTabRoute.extend
|
||||||
Travis.IndexRecentRoute = Travis.IndexTabRoute.extend
|
Travis.IndexRecentRoute = Travis.IndexTabRoute.extend
|
||||||
reposTabName: 'recent'
|
reposTabName: 'recent'
|
||||||
|
|
||||||
|
Travis.IndexSearchRoute = Travis.IndexTabRoute.extend
|
||||||
|
renderTemplate: ->
|
||||||
|
@render 'repo'
|
||||||
|
@render 'build', into: 'repo'
|
||||||
|
|
||||||
|
setupController: (controller, searchPhrase) ->
|
||||||
|
# TODO: this method is almost the same as _super, refactor this
|
||||||
|
@controllerFor('repo').activate('index')
|
||||||
|
@controllerFor('repos').activate('search', searchPhrase)
|
||||||
|
|
||||||
|
@currentRepoDidChange()
|
||||||
|
@controllerFor('repos').addObserver('firstObject', this, 'currentRepoDidChange')
|
||||||
|
|
||||||
|
model: (params) ->
|
||||||
|
params.phrase
|
||||||
|
|
||||||
|
deactivate: ->
|
||||||
|
@_super.apply(this, arguments)
|
||||||
|
|
||||||
|
@controllerFor('repos').set('search', undefined)
|
||||||
|
|
||||||
Travis.AbstractBuildsRoute = Travis.Route.extend
|
Travis.AbstractBuildsRoute = Travis.Route.extend
|
||||||
renderTemplate: ->
|
renderTemplate: ->
|
||||||
@render 'builds'
|
@render 'builds'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user