This commit is contained in:
Sven Fuchs 2012-07-07 04:26:58 +02:00
parent b2874c4516
commit 37523b3c07
8 changed files with 78 additions and 92 deletions

View File

@ -12,14 +12,6 @@ Travis.reopen
repositoryBinding: 'parent.repository' repositoryBinding: 'parent.repository'
contentBinding: 'parent.builds' contentBinding: 'parent.builds'
BuildController: Em.Controller.extend
repositoryBinding: 'layout.repository'
buildBinding: 'layout.build'
JobController: Em.Controller.extend
repositoryBinding: 'layout.repository'
jobBinding: 'layout.job'
QueuesController: Em.ArrayController.extend() QueuesController: Em.ArrayController.extend()
UserController: Em.Controller.extend() UserController: Em.Controller.extend()
HooksController: Em.ArrayController.extend() HooksController: Em.ArrayController.extend()

View File

@ -3,7 +3,7 @@ Travis.Controller = Em.Controller.extend
for name in Array.prototype.slice.apply(arguments) for name in Array.prototype.slice.apply(arguments)
name = "#{$.camelize(name, false)}Controller" name = "#{$.camelize(name, false)}Controller"
klass = Travis[$.camelize(name)] || Em.Controller klass = Travis[$.camelize(name)] || Em.Controller
this[name] = klass.create(namespace: Travis, controllers: this) this[name] = klass.create(parent: this, namespace: Travis, controllers: this)
connect: (parent) -> connect: (parent) ->
parent.connectOutlet parent.connectOutlet

View File

@ -1,61 +1,61 @@
Travis.RepositoryController = Travis.Controller.extend Travis.RepositoryController = Travis.Controller.extend
bindings: [] bindings: []
init: -> init: ->
@_super('builds', 'build', 'job') @_super('builds', 'build', 'job')
activate: (action, params) -> activate: (action, params) ->
@_unbind() @_unbind()
@set('params', params) this["view#{$.camelize(action)}"]()
this["view#{$.camelize(action)}"]() @set('params', params)
viewIndex: -> viewIndex: ->
@_bind('repository', 'controllers.repositoriesController.firstObject') @connectTab('current')
@_bind('build', 'repository.lastBuild') @_bind('repository', 'controllers.repositoriesController.firstObject')
@connectTab('current') @_bind('build', 'repository.lastBuild')
viewCurrent: -> viewCurrent: ->
@_bind('repository', 'repositoriesByParams.firstObject') @connectTab('current')
@_bind('build', 'repository.lastBuild') @_bind('repository', 'repositoriesByParams.firstObject')
@connectTab('current') @_bind('build', 'repository.lastBuild')
viewBuilds: -> viewBuilds: ->
@_bind('repository', 'repositoriesByParams.firstObject') @connectTab('builds')
@_bind('builds', 'repository.builds') @_bind('repository', 'repositoriesByParams.firstObject')
@connectTab('builds') @_bind('builds', 'repository.builds')
viewBuild: -> viewBuild: ->
@_bind('repository', 'repositoriesByParams.firstObject') @connectTab('build')
@_bind('build', 'buildById') @_bind('repository', 'repositoriesByParams.firstObject')
@connectTab('build') @_bind('build', 'buildById')
viewJob: -> viewJob: ->
@_bind('repository', 'repositoriesByParams.firstObject') @connectTab('job')
@_bind('build', 'job.build') @_bind('repository', 'repositoriesByParams.firstObject')
@_bind('job', 'jobById') @_bind('build', 'job.build')
@connectTab('job') @_bind('job', 'jobById')
repositoriesByParams: (-> repositoriesByParams: (->
Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params') Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params')
).property('params') ).property('params')
buildById: (-> buildById: (->
Travis.Build.find(id) if id = @getPath('params.id') Travis.Build.find(id) if id = @getPath('params.id')
).property('params.id') ).property('params.id')
jobById: (-> jobById: (->
Travis.Job.find(id) if id = @getPath('params.id') Travis.Job.find(id) if id = @getPath('params.id')
).property('params.id') ).property('params.id')
connectTab: (tab) -> connectTab: (tab) ->
@set('tab', tab) @set('tab', tab)
name = if tab == 'current' then 'build' else tab name = if tab == 'current' then 'build' else tab
@connectOutlet(outletName: 'pane', name: name) @connectOutlet(outletName: 'pane', controller: this, viewClass: Travis["#{$.camelize(name)}View"])
_bind: (to, from) -> _bind: (to, from) ->
@bindings.push Ember.oneWay(this, to, from) @bindings.push Ember.oneWay(this, to, from)
_unbind: -> _unbind: ->
binding.disconnect(this) for binding in @bindings binding.disconnect(this) for binding in @bindings
@bindings.length = 0 @bindings.length = 0

View File

@ -1,37 +1,35 @@
{{#if builds.isLoaded}} {{#if builds.isLoaded}}
{{#with view}} <table id="builds" class="list">
<table id="builds" class="list"> <thead>
<thead> <tr>
<tr> <th>{{t builds.name}}</th>
<th>{{t builds.name}}</th> <th>{{t builds.commit}}</th>
<th>{{t builds.commit}}</th> <th>{{t builds.message}}</th>
<th>{{t builds.message}}</th> <th>{{t builds.duration}}</th>
<th>{{t builds.duration}}</th> <th>{{t builds.finished_at}}</th>
<th>{{t builds.finished_at}}</th> </tr>
</tr> </thead>
</thead>
<tbody> <tbody>
{{#each build in builds}} {{#each build in builds}}
{{#view Travis.BuildsItemView contextBinding="build"}} {{#view Travis.BuildsItemView contextBinding="build"}}
<tr {{bindAttr class="view.color"}}> <tr {{bindAttr class="view.color"}}>
<td class="number"><a {{bindAttr href="view.urlBuild"}}>{{number}}</a></td> <td class="number"><a {{bindAttr href="view.urlBuild"}}>{{number}}</a></td>
<td class="commit"><a {{bindAttr href="view.urlGithubCommit"}}>{{formatCommit commit}}</a></td> <td class="commit"><a {{bindAttr href="view.urlGithubCommit"}}>{{formatCommit commit}}</a></td>
<td class="message">{{{formatMessage commit.message short="true"}}}</td> <td class="message">{{{formatMessage commit.message short="true"}}}</td>
<td class="duration" {{bindAttr title="started_at"}}>{{formatDuration duration}}</td> <td class="duration" {{bindAttr title="started_at"}}>{{formatDuration duration}}</td>
<td class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</td> <td class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finishedAt}}</td>
</tr> </tr>
{{/view}} {{/view}}
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
<p> <p>
<button {{action showMore on="click" target="builds" isVisibleBinding="hasMore"}}> <button {{action showMore on="click" target="builds" isVisibleBinding="hasMore"}}>
{{t builds.show_more}} {{t builds.show_more}}
</button> </button>
</p> </p>
{{/with}}
{{else}} {{else}}
<div id="builds" class="loading"> <div id="builds" class="loading">
<span>Loading</span> <span>Loading</span>

View File

@ -9,7 +9,7 @@
commitBinding: 'build.commit' commitBinding: 'build.commit'
color: (-> color: (->
Travis.Helpers.colorForResult(@getPath('context.result')) Travis.Helpers.colorForResult(@getPath('build.result'))
).property('build.result') ).property('build.result')
urlBuild: (-> urlBuild: (->

View File

@ -11520,8 +11520,6 @@ Ember.ControllerMixin.reopen({
var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View"; var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View";
viewClass = get(namespace, viewClassName); viewClass = get(namespace, viewClassName);
controller = get(controllers, name + 'Controller');
Ember.assert("The name you supplied " + name + " did not resolve to a view " + viewClassName, !!viewClass); Ember.assert("The name you supplied " + name + " did not resolve to a view " + viewClassName, !!viewClass);
Ember.assert("The name you supplied " + name + " did not resolve to a controller " + name + 'Controller', (!!controller && !!context) || !context); Ember.assert("The name you supplied " + name + " did not resolve to a controller " + name + 'Controller', (!!controller && !!context) || !context);
} }

File diff suppressed because one or more lines are too long

View File

@ -13474,8 +13474,6 @@ Ember.ControllerMixin.reopen({
var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View"; var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View";
viewClass = get(namespace, viewClassName); viewClass = get(namespace, viewClassName);
controller = get(controllers, name + 'Controller');
Ember.assert("The name you supplied " + name + " did not resolve to a view " + viewClassName, !!viewClass); Ember.assert("The name you supplied " + name + " did not resolve to a view " + viewClassName, !!viewClass);
Ember.assert("The name you supplied " + name + " did not resolve to a controller " + name + 'Controller', (!!controller && !!context) || !context); Ember.assert("The name you supplied " + name + " did not resolve to a controller " + name + 'Controller', (!!controller && !!context) || !context);
} }