mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Recently played is now shown on account page
This commit is contained in:
parent
1c6da9711b
commit
0d87209fa8
5 changed files with 25 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
CocoCollection = require './CocoCollections'
|
||||
CocoCollection = require './CocoCollection'
|
||||
LevelSession = require 'models/LevelSession'
|
||||
|
||||
module.exports = class RecentlyPlayedCollection extends CocoCollection
|
||||
|
|
|
@ -92,6 +92,25 @@ block content
|
|||
.col-sm-6
|
||||
h2 Recently Played
|
||||
hr
|
||||
if !recentlyPlayed
|
||||
div Loading...
|
||||
else if recentlyPlayed.length
|
||||
table.table
|
||||
tr
|
||||
th Level
|
||||
th Last Played
|
||||
th Status
|
||||
each session in recentlyPlayed
|
||||
tr
|
||||
td
|
||||
a(href="/play/level/#{session.get('levelID')}")= session.get('levelName')
|
||||
td= moment(session.get('changed')).fromNow()
|
||||
if session.get('state').complete === true
|
||||
td Completed
|
||||
else
|
||||
.panel.panel-default
|
||||
.panel-body
|
||||
div No games played during the past two weeks.
|
||||
|
||||
//block content
|
||||
h2 Account
|
||||
|
|
|
@ -3,6 +3,7 @@ template = require 'templates/account/home'
|
|||
{me} = require 'lib/auth'
|
||||
User = require 'models/User'
|
||||
AuthModalView = require 'views/modal/auth_modal'
|
||||
RecentlyPlayedCollection = require 'collections/RecentlyPlayedCollection'
|
||||
|
||||
module.exports = class AccountHomeView extends View
|
||||
id: 'account-home-view'
|
||||
|
@ -11,11 +12,13 @@ module.exports = class AccountHomeView extends View
|
|||
constructor: (options) ->
|
||||
super options
|
||||
return unless me
|
||||
@recentlyPlayed = @supermodel.loadCollection(new RecentlyPlayedCollection(me.get('_id')), 'recentlyPlayed').model
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.subs = {}
|
||||
c.subs[sub] = 1 for sub in c.me.getEnabledEmails()
|
||||
c.recentlyPlayed = @recentlyPlayed.models
|
||||
c
|
||||
|
||||
afterRender: ->
|
||||
|
|
|
@ -14,9 +14,9 @@ module.exports = class UserAchievementsView extends UserView
|
|||
super options, userID
|
||||
|
||||
onUserLoaded: (user) ->
|
||||
super user
|
||||
@achievements = @supermodel.loadCollection(new AchievementCollection, 'achievements').model
|
||||
@earnedAchievements = @supermodel.loadCollection(new EarnedAchievementCollection(@user), 'earnedAchievements').model
|
||||
super user
|
||||
|
||||
onLoaded: ->
|
||||
console.log @earnedAchievements
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
"i18next": "git://github.com/nwinter/i18next.git",
|
||||
"firepad": "~0.1.2",
|
||||
"marked": "~0.3.0",
|
||||
"moment": "~2.5.0",
|
||||
"aether": "~0.2.22",
|
||||
"underscore.string": "~2.3.3",
|
||||
"firebase": "~1.0.2",
|
||||
|
|
Loading…
Reference in a new issue