Tabs and basic views are mostly working
This commit is contained in:
parent
075e714fc3
commit
4cdd4df515
|
@ -1,5 +1,7 @@
|
||||||
Travis.BuildsController = Em.ArrayController.extend
|
Travis.BuildsController = Em.ArrayController.extend
|
||||||
# sortAscending: false
|
# sortAscending: false
|
||||||
|
needs: ['repo']
|
||||||
|
|
||||||
repo: 'parent.repo'
|
repoBinding: 'controllers.repo'
|
||||||
contentBinding: 'parent.builds'
|
buildsBinding: 'repo.builds'
|
||||||
|
tabBinding: 'controllers.repo.tab'
|
||||||
|
|
|
@ -16,6 +16,7 @@ require 'travis/model'
|
||||||
|
|
||||||
repo: DS.belongsTo('Travis.Repo')
|
repo: DS.belongsTo('Travis.Repo')
|
||||||
commit: DS.belongsTo('Travis.Commit')
|
commit: DS.belongsTo('Travis.Commit')
|
||||||
|
commits: DS.belongsTo('Travis.Commit')
|
||||||
jobs: DS.hasMany('Travis.Job')
|
jobs: DS.hasMany('Travis.Job')
|
||||||
|
|
||||||
config: (->
|
config: (->
|
||||||
|
|
|
@ -33,6 +33,7 @@ require 'travis/model'
|
||||||
builds: (->
|
builds: (->
|
||||||
id = @get('id')
|
id = @get('id')
|
||||||
builds = Travis.Build.byRepoId id, event_type: 'push'
|
builds = Travis.Build.byRepoId id, event_type: 'push'
|
||||||
|
# TODO: move to controller
|
||||||
array = Travis.ExpandableRecordArray.create
|
array = Travis.ExpandableRecordArray.create
|
||||||
type: Travis.Build
|
type: Travis.Build
|
||||||
content: Ember.A([])
|
content: Ember.A([])
|
||||||
|
|
|
@ -383,16 +383,33 @@ Travis.Router.map ->
|
||||||
@route 'index', path: '/'
|
@route 'index', path: '/'
|
||||||
@resource 'build', path: '/builds/:build_id'
|
@resource 'build', path: '/builds/:build_id'
|
||||||
@resource 'job', path: '/jobs/:job_id'
|
@resource 'job', path: '/jobs/:job_id'
|
||||||
|
@resource 'builds', path: '/builds'
|
||||||
|
@resource 'pullRequests', path: '/pull_requests'
|
||||||
|
|
||||||
Travis.IndexCurrentRoute = Ember.Route.extend
|
Travis.IndexCurrentRoute = Ember.Route.extend
|
||||||
renderTemplate: ->
|
renderTemplate: ->
|
||||||
@render 'build', outlet: 'pane', into: 'repo'
|
@render 'build', outlet: 'pane', into: 'repo'
|
||||||
|
|
||||||
setupController: ->
|
setupController: ->
|
||||||
@container.lookup('controller:repo').activate('index')
|
@container.lookup('controller:repo').activate('index')
|
||||||
|
|
||||||
|
Travis.BuildsRoute = Ember.Route.extend
|
||||||
|
renderTemplate: ->
|
||||||
|
@render 'builds', outlet: 'pane', into: 'repo'
|
||||||
|
|
||||||
|
setupController: ->
|
||||||
|
@container.lookup('controller:repo').activate('builds')
|
||||||
|
|
||||||
|
Travis.PullRequestsRoute = Ember.Route.extend
|
||||||
|
renderTemplate: ->
|
||||||
|
@render 'builds', outlet: 'pane', into: 'repo'
|
||||||
|
|
||||||
|
setupController: ->
|
||||||
|
@container.lookup('controller:repo').activate('pull_requests')
|
||||||
|
|
||||||
Travis.BuildRoute = Ember.Route.extend
|
Travis.BuildRoute = Ember.Route.extend
|
||||||
renderTemplate: (->)
|
renderTemplate: ->
|
||||||
|
@render 'build', outlet: 'pane', into: 'repo'
|
||||||
|
|
||||||
serialize: (model, params) ->
|
serialize: (model, params) ->
|
||||||
id = if model.get then model.get('id') else model
|
id = if model.get then model.get('id') else model
|
||||||
|
@ -427,10 +444,12 @@ Travis.RepoIndexRoute = Ember.Route.extend
|
||||||
setupController: (controller, model) ->
|
setupController: (controller, model) ->
|
||||||
@container.lookup('controller:repo').activate('current')
|
@container.lookup('controller:repo').activate('current')
|
||||||
|
|
||||||
|
renderTemplate: ->
|
||||||
|
@render 'build', outlet: 'pane', into: 'repo'
|
||||||
|
|
||||||
Travis.RepoRoute = Ember.Route.extend
|
Travis.RepoRoute = Ember.Route.extend
|
||||||
renderTemplate: ->
|
renderTemplate: ->
|
||||||
@render 'repo'
|
@render 'repo'
|
||||||
@render 'build', outlet: 'pane', into: 'repo'
|
|
||||||
|
|
||||||
setupController: (controller, model) ->
|
setupController: (controller, model) ->
|
||||||
controller.set('repo', model)
|
controller.set('repo', model)
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
<td class="number">
|
<td class="number">
|
||||||
<span class="status"></span>
|
<span class="status"></span>
|
||||||
{{#if id}}
|
{{#if id}}
|
||||||
<a {{action showBuild repo this href=true}}>
|
{{#linkTo "build" repo this}}
|
||||||
{{number}}
|
{{number}}
|
||||||
</a>
|
{{/linkTo}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td class="message">
|
<td class="message">
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
<td class="number">
|
<td class="number">
|
||||||
<span class="status"></span>
|
<span class="status"></span>
|
||||||
{{#if job.id}}
|
{{#if job.id}}
|
||||||
{{#linkTo job repo job}}{{number}}{{/linkTo}}
|
{{#if job.repo}}
|
||||||
|
{{#linkTo "job" repo job}}{{number}}{{/linkTo}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td class="duration" {{bindAttr title="startedAt"}}>
|
<td class="duration" {{bindAttr title="startedAt"}}>
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
<ul class="tabs">
|
<ul class="tabs">
|
||||||
<li id="tab_current" {{bindAttr class="view.classCurrent"}}>
|
<li id="tab_current" {{bindAttr class="view.classCurrent"}}>
|
||||||
<h5>
|
<h5>
|
||||||
{{#if view.repo.slug}}
|
{{#if slug}}
|
||||||
<a {{action showRepo view.repo href=true}}>
|
{{#linkTo "repo" this currentWhen="repo.index"}}
|
||||||
{{t repositories.tabs.current}}
|
{{t repositories.tabs.current}}
|
||||||
</a>
|
{{/linkTo}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</h5>
|
</h5>
|
||||||
</li>
|
</li>
|
||||||
<li id="tab_builds" {{bindAttr class="view.classBuilds"}}>
|
<li id="tab_builds" {{bindAttr class="view.classBuilds"}}>
|
||||||
<h5>
|
<h5>
|
||||||
{{#if view.repo.slug}}
|
{{#if slug}}
|
||||||
<a {{action showBuilds view.repo href=true}}>
|
{{#linkTo "builds" this}}
|
||||||
{{t repositories.tabs.build_history}}
|
{{t repositories.tabs.build_history}}
|
||||||
</a>
|
{{/linkTo}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</h5>
|
</h5>
|
||||||
</li>
|
</li>
|
||||||
<li id="tab_pull_requests" {{bindAttr class="view.classPullRequests"}}>
|
<li id="tab_pull_requests" {{bindAttr class="view.classPullRequests"}}>
|
||||||
<h5>
|
<h5>
|
||||||
{{#if view.repo.slug}}
|
{{#if slug}}
|
||||||
<a {{action showPullRequests view.repo href=true}}>
|
{{#linkTo "pullRequests" this}}
|
||||||
{{t repositories.tabs.pull_requests}}
|
{{t repositories.tabs.pull_requests}}
|
||||||
</a>
|
{{/linkTo}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</h5>
|
</h5>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
@Travis.reopen
|
Travis.reopen
|
||||||
BuildsView: Travis.View.extend
|
BuildsView: Travis.View.extend
|
||||||
templateName: 'builds/list'
|
templateName: 'builds/list'
|
||||||
buildsBinding: 'controller.builds'
|
buildsBinding: 'controller.builds'
|
||||||
|
|
||||||
isPullRequestsList: (->
|
isPullRequestsList: (->
|
||||||
console.log @get('controller.tab')
|
|
||||||
@get('controller.tab') == 'pull_requests'
|
@get('controller.tab') == 'pull_requests'
|
||||||
).property('controller.tab')
|
).property('controller.tab')
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,9 @@ Travis.ExpandableRecordArray = DS.RecordArray.extend
|
||||||
@pushObject object
|
@pushObject object
|
||||||
|
|
||||||
pushObject: (record) ->
|
pushObject: (record) ->
|
||||||
ids = @get 'content'
|
content = @get 'content'
|
||||||
id = record.get 'id'
|
id = record.get 'id'
|
||||||
clientId = record.get 'clientId'
|
clientId = record.get 'clientId'
|
||||||
|
reference = @get('store').referenceForClientId(clientId)
|
||||||
|
|
||||||
return if ids.contains clientId
|
@addReference reference
|
||||||
|
|
||||||
ids.pushObject clientId
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user