travis-web/assets/scripts/app/views/profile.coffee
Henrik Hodne e659659861 Download 2x images from Gravatar
This will make them look nicer on Retina screens. We may want to make
them even bigger if people are increasing the size of the page on
Travis, but doing that causes all kinds of alignment issues, so it's not
necessary to do now, I think.
2013-05-22 13:09:24 +02:00

70 lines
1.9 KiB
CoffeeScript

Travis.reopen
ProfileView: Travis.View.extend
templateName: 'profile/show'
accountBinding: 'controller.account'
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')
accountBinding: 'controller.account'
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')
UserView: Travis.View.extend
templateName: 'profile/tabs/user'
userBinding: 'controller.user'
gravatarUrl: (->
"#{location.protocol}//www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=96&d=mm"
).property('user.gravatarId')
locale: (->
@get('user.locale')
).property('user.locale')
locales: (->
[
{ key: null, name: '' }
{ key: 'en', name: 'English' }
{ key: 'es', name: 'Español' }
{ key: 'fr', name: 'Français' }
{ key: 'ja', name: '日本語' }
{ key: 'nl', name: 'Nederlands' }
{ key: 'nb', name: 'Norsk Bokmål' }
{ key: 'pl', name: 'Polski' }
{ key: 'pt-BR', name: 'Português brasileiro' }
{ key: 'ru', name: 'Русский' }
{ key: 'de', name: 'Deutsch' }
]
).property()
change: ->
return unless $('#locale').val()
@get('user').updateLocale($('#locale').val())