travis-web/assets/scripts/app/views/top.coffee
Piotr Sarnacki 3544d523d7 Refactor auth code
* don't use __container__
* register it as a factory on container and inject into routes and
  controller
* avoid afterSignIn errors by checking on hooksTarget, ApplicationRoute
  should register itself as a hooksTarget
* keep user info on auth
2014-05-28 10:22:47 +02:00

29 lines
681 B
CoffeeScript

@Travis.reopen
TopView: Travis.View.extend
templateName: 'layouts/top'
tabBinding: 'controller.tab'
# hrm. how to parametrize bind-attr?
classHome: (->
'active' if @get('tab') == 'home'
).property('tab')
classStats: (->
'active' if @get('tab') == 'stats'
).property('tab')
classProfile: (->
classes = ['profile menu']
classes.push('active') if @get('tab') == 'profile'
classes.push(@get('controller.auth.state') || 'signed-out')
classes.join(' ')
).property('tab', 'controller.auth.state')
showProfile: ->
$('#top .profile ul').show()
hideProfile: ->
$('#top .profile ul').hide()