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'
|
2014-07-21 13:06:22 -04:00
|
|
|
RecentlyPlayedCollection = require 'collections/RecentlyPlayedCollection'
|
2014-07-15 10:15:21 -04:00
|
|
|
|
2014-07-21 13:49:16 -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
|
2014-07-21 13:06:22 -04:00
|
|
|
@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()
|
2014-07-21 13:06:22 -04:00
|
|
|
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()
|