2014-07-06 14:45:27 -04:00
|
|
|
RootView = require 'views/kinds/RootView'
|
|
|
|
template = require 'templates/kinds/user'
|
|
|
|
User = require 'models/User'
|
|
|
|
|
|
|
|
module.exports = class UserView extends RootView
|
|
|
|
template: template
|
|
|
|
className: 'user-view'
|
|
|
|
|
2014-07-06 15:10:28 -04:00
|
|
|
constructor: (options, @nameOrID) ->
|
|
|
|
super options
|
|
|
|
|
2014-07-06 16:48:33 -04:00
|
|
|
@listenTo @, 'userLoaded', @onUserLoaded
|
2014-07-06 14:45:27 -04:00
|
|
|
|
2014-07-06 16:48:33 -04:00
|
|
|
# TODO Ruben Assume ID for now
|
2014-07-07 06:03:48 -04:00
|
|
|
@user = User.getByID @nameOrID, {}, true,
|
2014-07-06 16:48:33 -04:00
|
|
|
success: =>
|
|
|
|
@trigger 'userLoaded', @user
|
2014-07-06 15:10:28 -04:00
|
|
|
|
|
|
|
getRenderData: ->
|
|
|
|
context = super()
|
|
|
|
context.currentUserView = 'Achievements'
|
|
|
|
context.user = @user
|
|
|
|
context
|
|
|
|
|
2014-07-06 16:48:33 -04:00
|
|
|
isMe: -> @nameOrID is me.id
|
|
|
|
|
|
|
|
onUserLoaded: ->
|