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