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

@ -6,34 +6,34 @@ Travis.RepositoryController = Travis.Controller.extend
activate: (action, params) -> activate: (action, params) ->
@_unbind() @_unbind()
@set('params', params)
this["view#{$.camelize(action)}"]() this["view#{$.camelize(action)}"]()
@set('params', params)
viewIndex: -> viewIndex: ->
@connectTab('current')
@_bind('repository', 'controllers.repositoriesController.firstObject') @_bind('repository', 'controllers.repositoriesController.firstObject')
@_bind('build', 'repository.lastBuild') @_bind('build', 'repository.lastBuild')
@connectTab('current')
viewCurrent: -> viewCurrent: ->
@connectTab('current')
@_bind('repository', 'repositoriesByParams.firstObject') @_bind('repository', 'repositoriesByParams.firstObject')
@_bind('build', 'repository.lastBuild') @_bind('build', 'repository.lastBuild')
@connectTab('current')
viewBuilds: -> viewBuilds: ->
@connectTab('builds')
@_bind('repository', 'repositoriesByParams.firstObject') @_bind('repository', 'repositoriesByParams.firstObject')
@_bind('builds', 'repository.builds') @_bind('builds', 'repository.builds')
@connectTab('builds')
viewBuild: -> viewBuild: ->
@connectTab('build')
@_bind('repository', 'repositoriesByParams.firstObject') @_bind('repository', 'repositoriesByParams.firstObject')
@_bind('build', 'buildById') @_bind('build', 'buildById')
@connectTab('build')
viewJob: -> viewJob: ->
@connectTab('job')
@_bind('repository', 'repositoriesByParams.firstObject') @_bind('repository', 'repositoriesByParams.firstObject')
@_bind('build', 'job.build') @_bind('build', 'job.build')
@_bind('job', 'jobById') @_bind('job', 'jobById')
@connectTab('job')
repositoriesByParams: (-> repositoriesByParams: (->
Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params') Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params')
@ -50,7 +50,7 @@ Travis.RepositoryController = Travis.Controller.extend
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)

View File

@ -1,5 +1,4 @@
{{#if builds.isLoaded}} {{#if builds.isLoaded}}
{{#with view}}
<table id="builds" class="list"> <table id="builds" class="list">
<thead> <thead>
<tr> <tr>
@ -19,7 +18,7 @@
<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}}
@ -31,7 +30,6 @@
{{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);
} }