mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -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'
|
LevelSession = require 'models/LevelSession'
|
||||||
|
|
||||||
module.exports = class RecentlyPlayedCollection extends CocoCollection
|
module.exports = class RecentlyPlayedCollection extends CocoCollection
|
||||||
|
|
|
@ -92,6 +92,25 @@ block content
|
||||||
.col-sm-6
|
.col-sm-6
|
||||||
h2 Recently Played
|
h2 Recently Played
|
||||||
hr
|
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
|
//block content
|
||||||
h2 Account
|
h2 Account
|
||||||
|
|
|
@ -3,6 +3,7 @@ template = require 'templates/account/home'
|
||||||
{me} = require 'lib/auth'
|
{me} = require 'lib/auth'
|
||||||
User = require 'models/User'
|
User = require 'models/User'
|
||||||
AuthModalView = require 'views/modal/auth_modal'
|
AuthModalView = require 'views/modal/auth_modal'
|
||||||
|
RecentlyPlayedCollection = require 'collections/RecentlyPlayedCollection'
|
||||||
|
|
||||||
module.exports = class AccountHomeView extends View
|
module.exports = class AccountHomeView extends View
|
||||||
id: 'account-home-view'
|
id: 'account-home-view'
|
||||||
|
@ -11,11 +12,13 @@ module.exports = class AccountHomeView extends View
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super options
|
super options
|
||||||
return unless me
|
return unless me
|
||||||
|
@recentlyPlayed = @supermodel.loadCollection(new RecentlyPlayedCollection(me.get('_id')), 'recentlyPlayed').model
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
c = super()
|
c = super()
|
||||||
c.subs = {}
|
c.subs = {}
|
||||||
c.subs[sub] = 1 for sub in c.me.getEnabledEmails()
|
c.subs[sub] = 1 for sub in c.me.getEnabledEmails()
|
||||||
|
c.recentlyPlayed = @recentlyPlayed.models
|
||||||
c
|
c
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
|
|
|
@ -14,9 +14,9 @@ module.exports = class UserAchievementsView extends UserView
|
||||||
super options, userID
|
super options, userID
|
||||||
|
|
||||||
onUserLoaded: (user) ->
|
onUserLoaded: (user) ->
|
||||||
super user
|
|
||||||
@achievements = @supermodel.loadCollection(new AchievementCollection, 'achievements').model
|
@achievements = @supermodel.loadCollection(new AchievementCollection, 'achievements').model
|
||||||
@earnedAchievements = @supermodel.loadCollection(new EarnedAchievementCollection(@user), 'earnedAchievements').model
|
@earnedAchievements = @supermodel.loadCollection(new EarnedAchievementCollection(@user), 'earnedAchievements').model
|
||||||
|
super user
|
||||||
|
|
||||||
onLoaded: ->
|
onLoaded: ->
|
||||||
console.log @earnedAchievements
|
console.log @earnedAchievements
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
"i18next": "git://github.com/nwinter/i18next.git",
|
"i18next": "git://github.com/nwinter/i18next.git",
|
||||||
"firepad": "~0.1.2",
|
"firepad": "~0.1.2",
|
||||||
"marked": "~0.3.0",
|
"marked": "~0.3.0",
|
||||||
|
"moment": "~2.5.0",
|
||||||
"aether": "~0.2.22",
|
"aether": "~0.2.22",
|
||||||
"underscore.string": "~2.3.3",
|
"underscore.string": "~2.3.3",
|
||||||
"firebase": "~1.0.2",
|
"firebase": "~1.0.2",
|
||||||
|
|
Loading…
Reference in a new issue