codecombat/app/views/account/MainAccountView.coffee

27 lines
793 B
CoffeeScript
Raw Normal View History

2014-07-15 10:15:21 -04:00
View = require 'views/kinds/RootView'
template = require 'templates/account/home'
{me} = require 'lib/auth'
User = require 'models/User'
2014-07-29 11:28:13 -04:00
AuthModalView = require 'views/modal/AuthModal'
RecentlyPlayedCollection = require 'collections/RecentlyPlayedCollection'
2014-07-15 10:15:21 -04:00
module.exports = class MainAccountView extends View
2014-07-15 10:15:21 -04:00
id: 'account-home-view'
template: template
constructor: (options) ->
super options
return unless me
@recentlyPlayed = @supermodel.loadCollection(new RecentlyPlayedCollection(me.get('_id')), 'recentlyPlayed').model
2014-07-15 10:15:21 -04:00
2014-07-16 06:39:18 -04:00
getRenderData: ->
c = super()
c.subs = {}
c.subs[sub] = 1 for sub in c.me.getEnabledEmails()
c.recentlyPlayed = @recentlyPlayed.models
2014-07-16 06:39:18 -04:00
c
2014-07-15 10:15:21 -04:00
afterRender: ->
super()
@openModelView new AuthModalView if me.isAnonymous()