Merge branch 'master' into production

This commit is contained in:
Nick Winter 2016-01-25 12:29:33 -08:00
commit a1d6341aa3
8 changed files with 14 additions and 12 deletions

BIN
app/assets/docs/CodeCombatTeacherGuideCourse2.pdf Executable file → Normal file

Binary file not shown.

View file

@ -62,7 +62,7 @@ module.exports = class Tracker
@explicitTraits ?= {} @explicitTraits ?= {}
@explicitTraits[key] = value for key, value of traits @explicitTraits[key] = value for key, value of traits
for userTrait in ['email', 'anonymous', 'dateCreated', 'name', 'testGroupNumber', 'gender', 'lastLevel', 'siteref', 'ageRange'] for userTrait in ['email', 'anonymous', 'dateCreated', 'name', 'testGroupNumber', 'gender', 'lastLevel', 'siteref', 'ageRange', 'schoolName', 'coursePrepaidID']
traits[userTrait] ?= me.get(userTrait) traits[userTrait] ?= me.get(userTrait)
console.log 'Would identify', me.id, traits if debugAnalytics console.log 'Would identify', me.id, traits if debugAnalytics
return unless @isProduction and not me.isAdmin() return unless @isProduction and not me.isAdmin()

View file

@ -82,7 +82,7 @@ module.exports = class LankBoss extends CocoClass
console.error 'Lank collision! Already have:', id if @lanks[id] console.error 'Lank collision! Already have:', id if @lanks[id]
@lanks[id] = lank @lanks[id] = lank
@lankArray.push lank @lankArray.push lank
layer ?= @layerAdapters['Obstacle'] if lank.thang?.spriteName.search(/(dungeon|indoor|ice).wall/i) isnt -1 layer ?= @layerAdapters['Obstacle'] if lank.thang?.spriteName.search(/(dungeon|indoor|ice|classroom).wall/i) isnt -1
layer ?= @layerForChild lank.sprite, lank layer ?= @layerForChild lank.sprite, lank
layer.addLank lank layer.addLank lank
layer.updateLayerOrder() layer.updateLayerOrder()
@ -204,7 +204,7 @@ module.exports = class LankBoss extends CocoClass
cacheObstacles: (updatedObstacles=null) -> cacheObstacles: (updatedObstacles=null) ->
return if @cachedObstacles and not updatedObstacles return if @cachedObstacles and not updatedObstacles
lankArray = @lankArray lankArray = @lankArray
wallLanks = (lank for lank in lankArray when lank.thangType?.get('name').search(/(dungeon|indoor|ice).wall/i) isnt -1) wallLanks = (lank for lank in lankArray when lank.thangType?.get('name').search(/(dungeon|indoor|ice|classroom).wall/i) isnt -1)
return if _.any (s.stillLoading for s in wallLanks) return if _.any (s.stillLoading for s in wallLanks)
walls = (lank.thang for lank in wallLanks) walls = (lank.thang for lank in wallLanks)
@world.calculateBounds() @world.calculateBounds()

View file

@ -19,11 +19,11 @@ module.exports = class User extends CocoModel
broadName: -> broadName: ->
name = @get('name') name = @get('name')
return name if name return name if name
name = _.filter([@get('firstName'), @get('lastName')]).join('') name = _.filter([@get('firstName'), @get('lastName')]).join(' ')
return name if name return name if name
email = @get('email') email = @get('email')
return email if email return email if email
return '' return 'Anoner'
getPhotoURL: (size=80, useJobProfilePhoto=false, useEmployerPageAvatar=false) -> getPhotoURL: (size=80, useJobProfilePhoto=false, useEmployerPageAvatar=false) ->
photoURL = if useJobProfilePhoto then @get('jobProfile')?.photoURL else null photoURL = if useJobProfilePhoto then @get('jobProfile')?.photoURL else null

View file

@ -55,7 +55,7 @@ block content
for user in view.users.models for user in view.users.models
.row .row
.col-md-6 .col-md-6
.student-name= user.broadName() || 'Anoner' .student-name= user.broadName()
.col-md-6 .col-md-6
if view.teacherMode if view.teacherMode
a.remove-student-link.pull-right.text-uppercase(data-user-id=user.id) a.remove-student-link.pull-right.text-uppercase(data-user-id=user.id)

View file

@ -79,6 +79,7 @@ module.exports = class ClassroomView extends RootView
onLoaded: -> onLoaded: ->
@teacherMode = me.isAdmin() or @classroom.get('ownerID') is me.id @teacherMode = me.isAdmin() or @classroom.get('ownerID') is me.id
userSessions = @sessions.groupBy('creator') userSessions = @sessions.groupBy('creator')
@users.remove(@users.where({ deleted: true }))
for user in @users.models for user in @users.models
user.sessions = new CocoCollection(userSessions[user.id], { model: LevelSession }) user.sessions = new CocoCollection(userSessions[user.id], { model: LevelSession })
user.sessions.comparator = 'changed' user.sessions.comparator = 'changed'

View file

@ -104,13 +104,11 @@ class SolutionsNode extends TreemaArrayNode
onClickFillDefaults: (e) => onClickFillDefaults: (e) =>
e.preventDefault() e.preventDefault()
sources = {}
if source = @parent.data.source
sources.javascript = source
sources = { javascript: @parent.data.source } sources = { javascript: @parent.data.source }
_.extend sources, @parent.data.languages or {} _.extend sources, @parent.data.languages or {}
solutions = _.clone(@data) solutions = _.clone(@data)
solutions = _.filter(solutions, (solution) -> not _.isEmpty(solution) )
for language in _.keys(sources) for language in _.keys(sources)
source = sources[language] source = sources[language]
solution = _.findWhere(solutions, {language: language}) solution = _.findWhere(solutions, {language: language})

View file

@ -154,7 +154,10 @@ module.exports = class DocFormatter
content = popoverTemplate doc: @doc, docName: docName, language: @options.language, value: @formatValue(), marked: marked, argumentExamples: argumentExamples, writable: @options.writable, selectedMethod: @options.selectedMethod, cooldowns: @inferCooldowns(), item: @options.item content = popoverTemplate doc: @doc, docName: docName, language: @options.language, value: @formatValue(), marked: marked, argumentExamples: argumentExamples, writable: @options.writable, selectedMethod: @options.selectedMethod, cooldowns: @inferCooldowns(), item: @options.item
owner = if @doc.owner is 'this' then @options.thang else window[@doc.owner] owner = if @doc.owner is 'this' then @options.thang else window[@doc.owner]
content = @replaceSpriteName content content = @replaceSpriteName content
content.replace /\#\{(.*?)\}/g, (s, properties) => @formatValue downTheChain(owner, properties.split('.')) content = content.replace /\#\{(.*?)\}/g, (s, properties) => @formatValue downTheChain(owner, properties.split('.'))
content = content.replace /{([a-z]+)}([^]*?){\/\1}/g, (s, language, text) =>
if language is @options.language then return text
return ''
replaceSpriteName: (s) -> replaceSpriteName: (s) ->
# Prefer type, and excluded the quotes we'd get with @formatValue # Prefer type, and excluded the quotes we'd get with @formatValue