
Layout handling in travis-web was implemented in a dynamic way, so we could change a main layout from any of the routes. This needed a `rerender` call which was making things harder and needed some hacks. It also broke a few transitions when upgrading to 1.8.1. After examining our usage of layouts I've noticed that we don't need to change the entire layout dynamically and instead we can set layout on root routes (like "index", "profile" and other root routes).
46 lines
1.2 KiB
CoffeeScript
46 lines
1.2 KiB
CoffeeScript
Travis.reopen
|
|
ProfileView: Travis.View.extend
|
|
templateName: 'profile/show'
|
|
layoutName: 'layouts/profile'
|
|
classNames: ['application']
|
|
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')
|
|
|
|
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=200&d=mm"
|
|
).property('user.gravatarId')
|