mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-02 11:58:10 -05:00
Implemented singleplayer and multiplayer games played on profile
This commit is contained in:
parent
30a6cf1cca
commit
d4043ac3db
5 changed files with 66 additions and 25 deletions
|
@ -37,4 +37,8 @@ module.exports = class LevelSession extends CocoModel
|
||||||
return true if c1[thang][spell] isnt c2[thang]?[spell]
|
return true if c1[thang][spell] isnt c2[thang]?[spell]
|
||||||
false
|
false
|
||||||
|
|
||||||
isMultiPlayer: -> @get('team')? # Only multiplayer level sessions have teams defined
|
isMultiPlayer: ->
|
||||||
|
console.log @get 'levelName'
|
||||||
|
console.log @
|
||||||
|
console.log @get 'team'
|
||||||
|
@get('team')? # Only multiplayer level sessions have teams defined
|
||||||
|
|
|
@ -21,10 +21,17 @@
|
||||||
background-color: #ffe4bc
|
background-color: #ffe4bc
|
||||||
border: 4px solid white
|
border: 4px solid white
|
||||||
|
|
||||||
> .name
|
> .profile-info
|
||||||
|
background: white
|
||||||
|
|
||||||
|
.extra-info
|
||||||
|
padding-bottom: 3px
|
||||||
|
&:empty
|
||||||
|
display: none
|
||||||
|
|
||||||
|
.name
|
||||||
margin: 0px auto
|
margin: 0px auto
|
||||||
padding: 10px inherit
|
padding: 10px inherit
|
||||||
background: white
|
|
||||||
color: white
|
color: white
|
||||||
text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 1px 1px #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000
|
text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 1px 1px #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,9 @@ block content
|
||||||
td
|
td
|
||||||
a(href="/play/level/#{session.get('levelID')}")= session.get('levelName')
|
a(href="/play/level/#{session.get('levelID')}")= session.get('levelName')
|
||||||
td= moment(session.get('changed')).fromNow()
|
td= moment(session.get('changed')).fromNow()
|
||||||
|
td
|
||||||
if session.get('state').complete === true
|
if session.get('state').complete === true
|
||||||
td Completed
|
| Completed
|
||||||
else
|
else
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
.panel-body
|
.panel-body
|
||||||
|
|
|
@ -7,10 +7,11 @@ block append content
|
||||||
.left-column
|
.left-column
|
||||||
.profile-wrapper
|
.profile-wrapper
|
||||||
img.picture(src="#{me.getPhotoURL(150)}" alt="")
|
img.picture(src="#{me.getPhotoURL(150)}" alt="")
|
||||||
h3.name= user.get('name')
|
div.profile-info
|
||||||
if favoriteLanguage
|
h3.name= user.get('name')
|
||||||
div.profile-info Favorite language is
|
if favoriteLanguage
|
||||||
span= favoriteLanguage
|
div.extra-info Favorite language is
|
||||||
|
strong.spl.spr= favoriteLanguage
|
||||||
.btn-group-vertical.profile-menu
|
.btn-group-vertical.profile-menu
|
||||||
a.btn.btn-default(href="/user/#{user.get('slug') || user.get('_id')}/profile")
|
a.btn.btn-default(href="/user/#{user.get('slug') || user.get('_id')}/profile")
|
||||||
i.glyphicon.glyphicon-briefcase
|
i.glyphicon.glyphicon-briefcase
|
||||||
|
@ -57,20 +58,49 @@ block append content
|
||||||
.panel-body
|
.panel-body
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
.panel-heading
|
.panel-heading
|
||||||
h3.panel-title S. Levels
|
h3.panel-title Singleplayer Levels
|
||||||
.panel-body
|
if (!singlePlayerSessions)
|
||||||
if (!singlePlayerSessions)
|
.panel-body
|
||||||
p Loading...
|
p Loading...
|
||||||
else if (singlePlayerSessions.length)
|
else if (singlePlayerSessions.length)
|
||||||
table.table
|
table.table
|
||||||
|
tr
|
||||||
|
th Level
|
||||||
|
th Last Played
|
||||||
|
th Status
|
||||||
|
each session in singlePlayerSessions
|
||||||
tr
|
tr
|
||||||
th Level
|
td
|
||||||
th Last Played
|
if session.get('levelName')
|
||||||
th Status
|
a(href="/play/level/#{session.get('levelID')}")= session.get('levelName')
|
||||||
|
td= moment(session.get('changed')).fromNow()
|
||||||
//each session in singlePlayerSessions
|
if session.get('state').complete === true
|
||||||
|
td Completed
|
||||||
|
else
|
||||||
|
td Unfinished
|
||||||
|
else
|
||||||
|
.panel-body
|
||||||
|
p No Singleplayer games played yet.
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
.panel-heading
|
.panel-heading
|
||||||
h3.panel-title M. Levels
|
h3.panel-title Multiplayer Levels
|
||||||
.panel-body
|
if (!multiPlayerSessions)
|
||||||
|
.panel-body
|
||||||
|
p Loading...
|
||||||
|
else if (multiPlayerSessions.length)
|
||||||
|
table.table
|
||||||
|
tr
|
||||||
|
th Level
|
||||||
|
th Team
|
||||||
|
th Last Played
|
||||||
|
each session in multiPlayerSessions
|
||||||
|
tr
|
||||||
|
td
|
||||||
|
a(href="/play/level/#{session.get('levelID')}")= session.get('levelName')
|
||||||
|
td= session.get('team')
|
||||||
|
td= moment(session.get('changed')).fromNow()
|
||||||
|
if session.get('state').complete === true
|
||||||
|
td Completed
|
||||||
|
else
|
||||||
|
.panel-body
|
||||||
|
p No Multiplayer games played yet.
|
||||||
|
|
|
@ -8,7 +8,7 @@ class LevelSessionsCollection extends CocoCollection
|
||||||
model: LevelSession
|
model: LevelSession
|
||||||
|
|
||||||
constructor: (userID) ->
|
constructor: (userID) ->
|
||||||
@url = "/db/user/#{userID}/level.sessions?project=state.complete,levelID,levelName,changed,submittedCodeLanguage&order=-1"
|
@url = "/db/user/#{userID}/level.sessions?project=state.complete,levelID,levelName,changed,team,submittedCodeLanguage&order=-1"
|
||||||
super()
|
super()
|
||||||
|
|
||||||
module.exports = class MainUserView extends UserView
|
module.exports = class MainUserView extends UserView
|
||||||
|
@ -35,11 +35,10 @@ module.exports = class MainUserView extends UserView
|
||||||
for language, count of languageCounts
|
for language, count of languageCounts
|
||||||
if count > mostUsedCount
|
if count > mostUsedCount
|
||||||
mostUsedCount = count
|
mostUsedCount = count
|
||||||
language = favoriteLanguage
|
favoriteLanguage = language
|
||||||
context.favoriteLanguage = favoriteLanguage
|
|
||||||
context.singlePlayerSessions = singlePlayerSessions
|
context.singlePlayerSessions = singlePlayerSessions
|
||||||
context.multiPlayerSessions = multiPlayerSessions
|
context.multiPlayerSessions = multiPlayerSessions
|
||||||
console.debug context
|
context.favoriteLanguage = favoriteLanguage
|
||||||
context
|
context
|
||||||
|
|
||||||
onUserLoaded: (user) ->
|
onUserLoaded: (user) ->
|
||||||
|
|
Loading…
Reference in a new issue