fix owner routes and tabs

This commit is contained in:
Lisa Passing 2015-05-12 13:24:01 +02:00
parent ff107384c2
commit 1fb4a868be
12 changed files with 99 additions and 54 deletions

View File

@ -17,35 +17,19 @@ Controller = Ember.Controller.extend
owner: (->
data = @get('model')
{
login: data.login
name: data.name
isSyncing: data.is_syncing
avatarUrl: data.avatar_url
syncedAt: data.synced_at
builds: {
all: 'nope'
started: 'nope'
}
}
).property('model')
repos: (->
data = @get('model')
repos = data.repositories.filter (item, index) ->
if item.default_branch.last_build
item
repos.sortBy('default_branch.last_build.finished_at').reverse()
).property('model')
running: (->
data = @get('model')
repos = data.repositories.filter (item, index) ->
if item.default_branch.last_build != null
if item.default_branch.last_build.state == 'started'
item
repos
).property('model')
`export default Controller`

View File

@ -0,0 +1,28 @@
`import Ember from 'ember'`
`import Ajax from 'travis/utils/ajax'`
Controller = Ember.Controller.extend
isLoading: false
repos: (->
data = @get('model')
repos = data.repositories.filter (item, index) ->
if item.default_branch.last_build
item
repos.sortBy('default_branch.last_build.finished_at').reverse()
).property('model')
# running: (->
# data = @get('model')
# repos = data.repositories.filter (item, index) ->
# if item.default_branch.last_build != null
# if item.default_branch.last_build.state == 'started'
# item
# repos
# ).property('model')
`export default Controller`

View File

@ -4,8 +4,15 @@
Controller = Ember.Controller.extend
isLoading: false
test: ->
console.log('CONTROLLER')
running: (->
data = @get('model')
repos = data.repositories.filter (item, index) ->
if item.default_branch.last_build != null
if item.default_branch.last_build.state == 'started'
item
repos
).property('model')
`export default Controller`

View File

@ -72,6 +72,7 @@ Router.map ->
@route 'info', path: '/info'
@resource 'owner', path: '/:owner', ->
@route 'repositories', path: '/'
@route 'running', path: '/running'
@route 'error404', path: '/*path'

View File

@ -10,6 +10,6 @@ Route = TravisRoute.extend
"#{model.name}"
model: (params) ->
$.get(config.apiEndpoint + "/v3/owner/#{params.owner}?include=user.repositories,organization.repositories,build.commit,repository.active")
$.get(config.apiEndpoint + "/v3/owner/#{params.owner}")
`export default Route`

View File

@ -0,0 +1,15 @@
`import Ember from 'ember'`
`import TravisRoute from 'travis/routes/basic'`
`import Ajax from 'travis/utils/ajax'`
`import config from 'travis/config/environment'`
Route = TravisRoute.extend
needsAuth: false
titleToken: (model) ->
"#{model.name}"
model: (params, transition) ->
$.get(config.apiEndpoint + "/v3/owner/#{transition.params.owner.owner}?include=user.repositories,organization.repositories,build.commit,repository.active")
`export default Route`

View File

@ -1,9 +1,15 @@
`import Ember from 'ember'`
`import TravisRoute from 'travis/routes/basic'`
`import Ajax from 'travis/utils/ajax'`
`import config from 'travis/config/environment'`
Route = TravisRoute.extend
model: ->
console.log('This is the RUNNING route')
needsAuth: false
titleToken: (model) ->
"#{model.name}"
model: (params, transition) ->
$.get(config.apiEndpoint + "/v3/owner/#{transition.params.owner.owner}?include=user.repositories,organization.repositories,build.commit,repository.active")
`export default Route`

View File

@ -109,6 +109,21 @@
.tabs--owner
padding : 0 $column-gutter/2
.active,
.active:hover,
position: relative
color: $teal2
&:after
content: ""
position: absolute
left: 0
bottom: -0.25em
width: 100%
height: 2px
background-color: $teal1
.active
font-weight: 600
.tabnav--owner
margin-bottom: 1.5rem
@media #{$medium-up}

View File

@ -12,34 +12,17 @@
<div class="tabs--owner">
<nav class="tabnav tabnav--owner row" role="tablist">
<ul class="tab">
<li role="presentational">{{#link-to 'owner' owner.login}}All Repositories{{/link-to}}</li>
<li role="presentational">{{#link-to 'owner.running' owner.login}}Running Builds (2/5){{/link-to}}</li>
<li role="presentational">{{#link-to 'owner.repositories' owner.login}}All Repositories{{/link-to}}</li>
<li role="presentational">{{#link-to 'owner.running' owner.login}}Running Builds ({{owner.builds.started}}/{{owner.builds.all}}){{/link-to}}</li>
{{!-- <li role="presentational"><a href="#" title="" role="tab">Members</a></li> --}}
</ul>
</nav>
<div class="tabbody">
<section role="tabpanel">
<ul class="owner-tiles">
{{#each repo in repos}}
{{owner-repo-tile repo=repo}}
{{else}}
<li>No active repos</li>
{{/each}}
</ul>
{{outlet}}
</section>
{{!-- <section role="tabpanel">
<ul class="owner-tiles">
{{#each repo in running}}
{{owner-repo-tile repo=repo}}
{{else}}
<li>No running builds</li>
{{/each}}
</ul>
</section>
--}}
{{!-- <section role="tabpanel">
<ul class="memberlist">
<li class="columns small-6 large-4">

View File

@ -0,0 +1,7 @@
<ul class="owner-tiles">
{{#each repo in repos}}
{{owner-repo-tile repo=repo}}
{{else}}
<li>No active repos</li>
{{/each}}
</ul>

View File

@ -1 +1,7 @@
hello
<ul class="owner-tiles">
{{#each repo in running}}
{{owner-repo-tile repo=repo}}
{{else}}
<li>No running builds</li>
{{/each}}
</ul>

View File

@ -1,7 +0,0 @@
`import Ember from 'ember'`
View = Ember.View.extend
layoutName: 'layouts/profile'
classNames: ['owner', 'running']
`export default View`