Show all accounts and hooks in profile

Previously we showed only accounts and repositories, to which you have
admin access. To improve usability, it's better to show all accounts and
all repositories, but explain why part of the repositories are not
manageable.
This commit is contained in:
Piotr Sarnacki 2013-06-18 17:54:09 +02:00
parent 357aa3a563
commit c7516b458e
6 changed files with 47 additions and 5 deletions

View File

@ -1,6 +1,8 @@
Travis.AccountIndexController = Em.Controller.extend Travis.AccountIndexController = Em.Controller.extend
needs: ['profile', 'currentUser'] needs: ['profile', 'currentUser']
hooksBinding: 'controllers.profile.hooks' hooksBinding: 'controllers.profile.hooks'
allHooksBinding: 'controllers.profile.allHooks'
unAdminisetableHooksBinding: 'controllers.profile.unAdminisetableHooks'
userBinding: 'controllers.currentUser' userBinding: 'controllers.currentUser'
sync: -> sync: ->

View File

@ -35,7 +35,15 @@ Travis.ProfileController = Travis.Controller.extend
@reloadHooks() @reloadHooks()
reloadHooks: -> reloadHooks: ->
@set('hooks', Travis.Hook.find(owner_name: @get('params.login') || @get('user.login'))) @set('allHooks', Travis.Hook.find(all: true, owner_name: @get('params.login') || @get('user.login')))
hooks: (->
@get('allHooks').filter (hook) -> hook.get('admin')
).property('allHooks.length', 'allHooks')
unAdminisetableHooks: (->
@get('allHooks').filter (hook) -> !hook.get('admin')
).property('allHooks.length', 'allHooks')
viewUser: -> viewUser: ->
@connectTab('user') @connectTab('user')

View File

@ -5,6 +5,7 @@ require 'travis/model'
ownerName: DS.attr('string') ownerName: DS.attr('string')
description: DS.attr('string') description: DS.attr('string')
active: DS.attr('boolean') active: DS.attr('boolean')
admin: DS.attr('boolean')
account: (-> account: (->
@get('slug').split('/')[0] @get('slug').split('/')[0]

View File

@ -328,7 +328,7 @@ Travis.ProfileRoute = Ember.Route.extend
setupController: -> setupController: ->
@container.lookup('controller:application').connectLayout('profile') @container.lookup('controller:application').connectLayout('profile')
@container.lookup('controller:accounts').set('content', Travis.Account.find()) @container.lookup('controller:accounts').set('content', Travis.Account.find(all: true))
renderTemplate: -> renderTemplate: ->
$('body').attr('id', 'profile') $('body').attr('id', 'profile')

View File

@ -2,7 +2,7 @@
{{{t profiles.show.message.your_repos}}} {{{t profiles.show.message.your_repos}}}
</p> </p>
{{#if hooks.isLoaded}} {{#if allHooks.isLoaded}}
{{#if user.isSyncing}} {{#if user.isSyncing}}
<p class="message loading"> <p class="message loading">
<span>Please wait while we sync from GitHub</span> <span>Please wait while we sync from GitHub</span>
@ -35,10 +35,33 @@
</li> </li>
{{else}} {{else}}
<li> <li>
You do not seem to have any repositories that we could sync. {{#if unAdminisetableHooks.length}}
You do not have any repositories, which you can manage
{{else}}
You do not seem to have any repositories that we could sync.
{{/if}}
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
{{#if unAdminisetableHooks.length}}
<div id="unadministerable-hooks">
<h3>Repositories without admin access</h3>
<p class="tip">
These are the repositories, which we synced, but you do not seem to have admin access for them.
</p>
<ul>
{{#each hook in unAdminisetableHooks}}
<li {{bindAttr class="hook.active:active"}}>
<a {{bindAttr href="hook.urlGithub"}} rel="nofollow">{{hook.slug}}</a>
<p class="description">{{hook.description}}</p>
</li>
{{/each}}
</ul>
</div>
{{/if}}
{{/if}} {{/if}}
{{else}} {{else}}
<p class="message loading"> <p class="message loading">

View File

@ -1,6 +1,14 @@
@import "_mixins/all" @import "_mixins/all"
#hooks #profile
#unadministerable-hooks
margin-top: 15px
h3
font-size: $font-size-big
.tip
margin-top: 5px
#hooks, #unadministerable-hooks
// @include list-base // @include list-base
margin-top: 10px margin-top: 10px