Fix build view and links on left sidebar
This commit is contained in:
parent
f0e95ddd3f
commit
8ccd95e0b0
|
@ -65,11 +65,6 @@ Travis.RepoController = Travis.Controller.extend
|
||||||
@_bind('build', 'job.build')
|
@_bind('build', 'job.build')
|
||||||
@connectTab('job')
|
@connectTab('job')
|
||||||
|
|
||||||
repoObserver: (->
|
|
||||||
repo = @get('repo')
|
|
||||||
repo.select() if repo
|
|
||||||
).observes('repo.id')
|
|
||||||
|
|
||||||
connectTab: (tab) ->
|
connectTab: (tab) ->
|
||||||
name = if tab == 'current' then 'build' else tab
|
name = if tab == 'current' then 'build' else tab
|
||||||
viewClass = if name in ['builds', 'branches', 'pull_requests']
|
viewClass = if name in ['builds', 'branches', 'pull_requests']
|
||||||
|
|
|
@ -377,6 +377,76 @@ Ember.Router.reopen
|
||||||
location: Ember.HistoryLocation.create()
|
location: Ember.HistoryLocation.create()
|
||||||
|
|
||||||
Travis.Router.map ->
|
Travis.Router.map ->
|
||||||
|
@resource 'index', path: '/', ->
|
||||||
|
@route 'current', path: '/'
|
||||||
|
@resource 'repo', path: '/:owner/:name', ->
|
||||||
|
@route 'index', path: '/'
|
||||||
|
@resource 'build', path: '/builds/:build_id'
|
||||||
|
|
||||||
|
Travis.IndexCurrentRoute = Ember.Route.extend
|
||||||
|
renderTemplate: ->
|
||||||
|
@render 'repo'
|
||||||
|
@render 'build', outlet: 'pane', into: 'repo'
|
||||||
|
|
||||||
|
setupController: ->
|
||||||
|
@container.lookup('controller:repo').activate('index')
|
||||||
|
|
||||||
|
Travis.BuildRoute = Ember.Route.extend
|
||||||
|
renderTemplate: (->)
|
||||||
|
|
||||||
|
|
||||||
|
deserialize: (params) ->
|
||||||
|
Travis.Build.find(params.build_id)
|
||||||
|
|
||||||
|
serialize: (model, params) ->
|
||||||
|
id = if model.get
|
||||||
|
model.get('id')
|
||||||
|
else
|
||||||
|
model
|
||||||
|
|
||||||
|
{ build_id: id }
|
||||||
|
|
||||||
|
setupController: (controller, model) ->
|
||||||
|
model = Travis.Build.find(model) if model && !model.get
|
||||||
|
|
||||||
|
repo = @container.lookup('controller:repo')
|
||||||
|
repo.activate('build')
|
||||||
|
repo.set('build', model)
|
||||||
|
|
||||||
|
Travis.RepoIndexRoute = Ember.Route.extend
|
||||||
|
setupController: (controller, model) ->
|
||||||
|
@container.lookup('controller:repo').activate('current')
|
||||||
|
|
||||||
|
Travis.RepoRoute = Ember.Route.extend
|
||||||
|
renderTemplate: ->
|
||||||
|
@render 'repo'
|
||||||
|
@render 'build', outlet: 'pane', into: 'repo'
|
||||||
|
|
||||||
|
setupController: (controller, model) ->
|
||||||
|
controller.set('repo', model)
|
||||||
|
|
||||||
|
serialize: (repo) ->
|
||||||
|
[owner, name] = repo.get('slug').split('/')
|
||||||
|
{ owner: owner, name: name }
|
||||||
|
|
||||||
|
deserialize: (params) ->
|
||||||
|
slug = "#{params.owner}/#{params.name}"
|
||||||
|
proxy = Ember.ObjectProxy.create(content: Ember.Object.create())
|
||||||
|
proxy.setProperties slug: slug, isLoaded: false
|
||||||
|
|
||||||
|
repos = Travis.Repo.bySlug(slug)
|
||||||
|
|
||||||
|
observer = ->
|
||||||
|
if repos.get 'isLoaded'
|
||||||
|
repos.removeObserver 'isLoaded', observer
|
||||||
|
proxy.set 'content', repos.objectAt(0)
|
||||||
|
|
||||||
|
if repos.length
|
||||||
|
proxy.set('content', repos[0])
|
||||||
|
else
|
||||||
|
repos.addObserver 'isLoaded', observer
|
||||||
|
|
||||||
|
proxy
|
||||||
|
|
||||||
Travis.IndexRoute = Ember.Route.extend
|
Travis.IndexRoute = Ember.Route.extend
|
||||||
renderTemplate: ->
|
renderTemplate: ->
|
||||||
|
@ -386,10 +456,7 @@ Travis.IndexRoute = Ember.Route.extend
|
||||||
@render 'sidebar', outlet: 'right'
|
@render 'sidebar', outlet: 'right'
|
||||||
@render 'top', outlet: 'top'
|
@render 'top', outlet: 'top'
|
||||||
@render 'flash', outlet: 'flash'
|
@render 'flash', outlet: 'flash'
|
||||||
@render 'repo'
|
|
||||||
@render 'build', outlet: 'pane', into: 'repo'
|
|
||||||
|
|
||||||
setupController: (controller)->
|
setupController: (controller)->
|
||||||
@container.lookup('controller:repos').activate()
|
@container.lookup('controller:repos').activate()
|
||||||
@container.lookup('view:application').connectLayout 'home'
|
@container.lookup('view:application').connectLayout 'home'
|
||||||
@container.lookup('controller:repo').activate('index')
|
|
||||||
|
|
|
@ -9,14 +9,10 @@
|
||||||
{{#with view.repo}}
|
{{#with view.repo}}
|
||||||
<div class="slug-and-status">
|
<div class="slug-and-status">
|
||||||
<span class="status"></span>
|
<span class="status"></span>
|
||||||
{{#if slug}}
|
{{#linkTo repo this class="slug"}}{{slug}}{{/linkTo}}
|
||||||
<a {{action showRepo this href=true}} class="slug">{{slug}}</a>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
{{#with lastBuildHash}}
|
{{#with lastBuildHash}}
|
||||||
{{#if id}}
|
{{#linkTo build repo id class="last_build"}}{{number}}{{/linkTo}}
|
||||||
<a {{action showBuild repo id href=true}} class="last_build">{{number}}</a>
|
|
||||||
{{/if}}
|
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
<p class="summary">
|
<p class="summary">
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
|
|
||||||
BuildView: Travis.View.extend
|
BuildView: Travis.View.extend
|
||||||
templateName: 'builds/show'
|
templateName: 'builds/show'
|
||||||
elementId: 'build'
|
|
||||||
classNameBindings: ['color', 'loading']
|
classNameBindings: ['color', 'loading']
|
||||||
|
|
||||||
loadingBinding: 'controller.loading'
|
loadingBinding: 'controller.loading'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user