mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -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]
|
||||
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
|
||||
border: 4px solid white
|
||||
|
||||
> .name
|
||||
> .profile-info
|
||||
background: white
|
||||
|
||||
.extra-info
|
||||
padding-bottom: 3px
|
||||
&:empty
|
||||
display: none
|
||||
|
||||
.name
|
||||
margin: 0px auto
|
||||
padding: 10px inherit
|
||||
background: 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
|
||||
|
||||
|
|
|
@ -110,8 +110,9 @@ block content
|
|||
td
|
||||
a(href="/play/level/#{session.get('levelID')}")= session.get('levelName')
|
||||
td= moment(session.get('changed')).fromNow()
|
||||
td
|
||||
if session.get('state').complete === true
|
||||
td Completed
|
||||
| Completed
|
||||
else
|
||||
.panel.panel-default
|
||||
.panel-body
|
||||
|
|
|
@ -7,10 +7,11 @@ block append content
|
|||
.left-column
|
||||
.profile-wrapper
|
||||
img.picture(src="#{me.getPhotoURL(150)}" alt="")
|
||||
h3.name= user.get('name')
|
||||
if favoriteLanguage
|
||||
div.profile-info Favorite language is
|
||||
span= favoriteLanguage
|
||||
div.profile-info
|
||||
h3.name= user.get('name')
|
||||
if favoriteLanguage
|
||||
div.extra-info Favorite language is
|
||||
strong.spl.spr= favoriteLanguage
|
||||
.btn-group-vertical.profile-menu
|
||||
a.btn.btn-default(href="/user/#{user.get('slug') || user.get('_id')}/profile")
|
||||
i.glyphicon.glyphicon-briefcase
|
||||
|
@ -57,20 +58,49 @@ block append content
|
|||
.panel-body
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
h3.panel-title S. Levels
|
||||
.panel-body
|
||||
if (!singlePlayerSessions)
|
||||
h3.panel-title Singleplayer Levels
|
||||
if (!singlePlayerSessions)
|
||||
.panel-body
|
||||
p Loading...
|
||||
else if (singlePlayerSessions.length)
|
||||
table.table
|
||||
else if (singlePlayerSessions.length)
|
||||
table.table
|
||||
tr
|
||||
th Level
|
||||
th Last Played
|
||||
th Status
|
||||
each session in singlePlayerSessions
|
||||
tr
|
||||
th Level
|
||||
th Last Played
|
||||
th Status
|
||||
|
||||
//each session in singlePlayerSessions
|
||||
|
||||
td
|
||||
if session.get('levelName')
|
||||
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
|
||||
td Unfinished
|
||||
else
|
||||
.panel-body
|
||||
p No Singleplayer games played yet.
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
h3.panel-title M. Levels
|
||||
.panel-body
|
||||
h3.panel-title Multiplayer Levels
|
||||
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
|
||||
|
||||
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()
|
||||
|
||||
module.exports = class MainUserView extends UserView
|
||||
|
@ -35,11 +35,10 @@ module.exports = class MainUserView extends UserView
|
|||
for language, count of languageCounts
|
||||
if count > mostUsedCount
|
||||
mostUsedCount = count
|
||||
language = favoriteLanguage
|
||||
context.favoriteLanguage = favoriteLanguage
|
||||
favoriteLanguage = language
|
||||
context.singlePlayerSessions = singlePlayerSessions
|
||||
context.multiPlayerSessions = multiPlayerSessions
|
||||
console.debug context
|
||||
context.favoriteLanguage = favoriteLanguage
|
||||
context
|
||||
|
||||
onUserLoaded: (user) ->
|
||||
|
|
Loading…
Reference in a new issue