cleanup
This commit is contained in:
parent
b2874c4516
commit
37523b3c07
|
@ -12,14 +12,6 @@ Travis.reopen
|
|||
repositoryBinding: 'parent.repository'
|
||||
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()
|
||||
UserController: Em.Controller.extend()
|
||||
HooksController: Em.ArrayController.extend()
|
||||
|
|
|
@ -3,7 +3,7 @@ Travis.Controller = Em.Controller.extend
|
|||
for name in Array.prototype.slice.apply(arguments)
|
||||
name = "#{$.camelize(name, false)}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) ->
|
||||
parent.connectOutlet
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
Travis.RepositoryController = Travis.Controller.extend
|
||||
bindings: []
|
||||
bindings: []
|
||||
|
||||
init: ->
|
||||
@_super('builds', 'build', 'job')
|
||||
init: ->
|
||||
@_super('builds', 'build', 'job')
|
||||
|
||||
activate: (action, params) ->
|
||||
@_unbind()
|
||||
@set('params', params)
|
||||
this["view#{$.camelize(action)}"]()
|
||||
activate: (action, params) ->
|
||||
@_unbind()
|
||||
this["view#{$.camelize(action)}"]()
|
||||
@set('params', params)
|
||||
|
||||
viewIndex: ->
|
||||
@_bind('repository', 'controllers.repositoriesController.firstObject')
|
||||
@_bind('build', 'repository.lastBuild')
|
||||
@connectTab('current')
|
||||
viewIndex: ->
|
||||
@connectTab('current')
|
||||
@_bind('repository', 'controllers.repositoriesController.firstObject')
|
||||
@_bind('build', 'repository.lastBuild')
|
||||
|
||||
viewCurrent: ->
|
||||
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||
@_bind('build', 'repository.lastBuild')
|
||||
@connectTab('current')
|
||||
viewCurrent: ->
|
||||
@connectTab('current')
|
||||
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||
@_bind('build', 'repository.lastBuild')
|
||||
|
||||
viewBuilds: ->
|
||||
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||
@_bind('builds', 'repository.builds')
|
||||
@connectTab('builds')
|
||||
viewBuilds: ->
|
||||
@connectTab('builds')
|
||||
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||
@_bind('builds', 'repository.builds')
|
||||
|
||||
viewBuild: ->
|
||||
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||
@_bind('build', 'buildById')
|
||||
@connectTab('build')
|
||||
viewBuild: ->
|
||||
@connectTab('build')
|
||||
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||
@_bind('build', 'buildById')
|
||||
|
||||
viewJob: ->
|
||||
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||
@_bind('build', 'job.build')
|
||||
@_bind('job', 'jobById')
|
||||
@connectTab('job')
|
||||
viewJob: ->
|
||||
@connectTab('job')
|
||||
@_bind('repository', 'repositoriesByParams.firstObject')
|
||||
@_bind('build', 'job.build')
|
||||
@_bind('job', 'jobById')
|
||||
|
||||
repositoriesByParams: (->
|
||||
Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params')
|
||||
).property('params')
|
||||
repositoriesByParams: (->
|
||||
Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params')
|
||||
).property('params')
|
||||
|
||||
buildById: (->
|
||||
Travis.Build.find(id) if id = @getPath('params.id')
|
||||
).property('params.id')
|
||||
buildById: (->
|
||||
Travis.Build.find(id) if id = @getPath('params.id')
|
||||
).property('params.id')
|
||||
|
||||
jobById: (->
|
||||
Travis.Job.find(id) if id = @getPath('params.id')
|
||||
).property('params.id')
|
||||
jobById: (->
|
||||
Travis.Job.find(id) if id = @getPath('params.id')
|
||||
).property('params.id')
|
||||
|
||||
connectTab: (tab) ->
|
||||
@set('tab', tab)
|
||||
name = if tab == 'current' then 'build' else tab
|
||||
@connectOutlet(outletName: 'pane', name: name)
|
||||
connectTab: (tab) ->
|
||||
@set('tab', tab)
|
||||
name = if tab == 'current' then 'build' else tab
|
||||
@connectOutlet(outletName: 'pane', controller: this, viewClass: Travis["#{$.camelize(name)}View"])
|
||||
|
||||
_bind: (to, from) ->
|
||||
@bindings.push Ember.oneWay(this, to, from)
|
||||
_bind: (to, from) ->
|
||||
@bindings.push Ember.oneWay(this, to, from)
|
||||
|
||||
_unbind: ->
|
||||
binding.disconnect(this) for binding in @bindings
|
||||
@bindings.length = 0
|
||||
_unbind: ->
|
||||
binding.disconnect(this) for binding in @bindings
|
||||
@bindings.length = 0
|
||||
|
||||
|
|
|
@ -1,37 +1,35 @@
|
|||
{{#if builds.isLoaded}}
|
||||
{{#with view}}
|
||||
<table id="builds" class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{t builds.name}}</th>
|
||||
<th>{{t builds.commit}}</th>
|
||||
<th>{{t builds.message}}</th>
|
||||
<th>{{t builds.duration}}</th>
|
||||
<th>{{t builds.finished_at}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<table id="builds" class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{t builds.name}}</th>
|
||||
<th>{{t builds.commit}}</th>
|
||||
<th>{{t builds.message}}</th>
|
||||
<th>{{t builds.duration}}</th>
|
||||
<th>{{t builds.finished_at}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{#each build in builds}}
|
||||
{{#view Travis.BuildsItemView contextBinding="build"}}
|
||||
<tr {{bindAttr class="view.color"}}>
|
||||
<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="message">{{{formatMessage commit.message short="true"}}}</td>
|
||||
<td class="duration" {{bindAttr title="started_at"}}>{{formatDuration duration}}</td>
|
||||
<td class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</td>
|
||||
</tr>
|
||||
{{/view}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
<tbody>
|
||||
{{#each build in builds}}
|
||||
{{#view Travis.BuildsItemView contextBinding="build"}}
|
||||
<tr {{bindAttr class="view.color"}}>
|
||||
<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="message">{{{formatMessage commit.message short="true"}}}</td>
|
||||
<td class="duration" {{bindAttr title="started_at"}}>{{formatDuration duration}}</td>
|
||||
<td class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finishedAt}}</td>
|
||||
</tr>
|
||||
{{/view}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<button {{action showMore on="click" target="builds" isVisibleBinding="hasMore"}}>
|
||||
{{t builds.show_more}}
|
||||
</button>
|
||||
</p>
|
||||
{{/with}}
|
||||
<p>
|
||||
<button {{action showMore on="click" target="builds" isVisibleBinding="hasMore"}}>
|
||||
{{t builds.show_more}}
|
||||
</button>
|
||||
</p>
|
||||
{{else}}
|
||||
<div id="builds" class="loading">
|
||||
<span>Loading</span>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
commitBinding: 'build.commit'
|
||||
|
||||
color: (->
|
||||
Travis.Helpers.colorForResult(@getPath('context.result'))
|
||||
Travis.Helpers.colorForResult(@getPath('build.result'))
|
||||
).property('build.result')
|
||||
|
||||
urlBuild: (->
|
||||
|
|
2
assets/javascripts/vendor/ember.js
vendored
2
assets/javascripts/vendor/ember.js
vendored
|
@ -11520,8 +11520,6 @@ Ember.ControllerMixin.reopen({
|
|||
|
||||
var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View";
|
||||
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 controller " + name + 'Controller', (!!controller && !!context) || !context);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13474,8 +13474,6 @@ Ember.ControllerMixin.reopen({
|
|||
|
||||
var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View";
|
||||
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 controller " + name + 'Controller', (!!controller && !!context) || !context);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user