travis-web/assets/scripts/app/views/profile.coffee
2015-01-15 17:08:40 +01:00

48 lines
1.3 KiB
CoffeeScript

Travis.reopen
ProfileView: Travis.View.extend
templateName: 'profile/show'
layoutName: 'layouts/profile'
classNames: ['profile-view']
accountBinding: 'controller.account'
subscribedBinding: 'account.subscribed'
educationBinding: 'account.education'
name: (->
@get('account.name') || @get('account.login')
).property('account.name', 'account.login')
ProfileTabsView: Travis.View.extend
templateName: 'profile/tabs'
tabBinding: 'controller.tab'
activate: ->
@get('controller').activate(event.target.name)
classHooks: (->
'active' if @get('tab') == 'hooks'
).property('tab')
classUser: (->
'active' if @get('tab') == 'user'
).property('tab')
displayUser: (->
@get('controller.account.login') == @get('controller.user.login')
).property('controller.account.login', 'controller.user.login')
HooksView: Travis.View.extend
templateName: 'profile/tabs/hooks'
userBinding: 'controller.user'
urlGithubAdmin: (->
Travis.Urls.githubAdmin(@get('hook.slug'))
).property('hook.slug')
AccountsInfoView: Travis.View.extend
templateName: 'profile/tabs/user'
userBinding: 'controller.user'
gravatarUrl: (->
"#{location.protocol}//www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=200&d=mm"
).property('user.gravatarId')