From dd88f397610312f75632bfe81c608dd09d726d3e Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 14 Jul 2016 15:48:42 -0700 Subject: [PATCH 1/2] Add shareable property to levels --- app/schemas/models/classroom.schema.coffee | 1 + app/schemas/models/level.coffee | 1 + app/views/editor/level/settings/SettingsTabView.coffee | 1 + server/handlers/level_handler.coffee | 1 + server/middleware/classrooms.coffee | 2 +- 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/schemas/models/classroom.schema.coffee b/app/schemas/models/classroom.schema.coffee index c06aebe2e..9f3e63ca7 100644 --- a/app/schemas/models/classroom.schema.coffee +++ b/app/schemas/models/classroom.schema.coffee @@ -25,6 +25,7 @@ _.extend ClassroomSchema.properties, levels: c.array { title: 'Levels' }, c.object { title: 'Level' }, { practice: {type: 'boolean'} practiceThresholdMinutes: {type: 'number'} + shareable: {type: 'boolean'} type: c.shortString() original: c.objectId() name: {type: 'string'} diff --git a/app/schemas/models/level.coffee b/app/schemas/models/level.coffee index b7b826e76..707bf6cd4 100644 --- a/app/schemas/models/level.coffee +++ b/app/schemas/models/level.coffee @@ -325,6 +325,7 @@ _.extend LevelSchema.properties, replayable: {type: 'boolean', title: 'Replayable', description: 'Whether this (hero) level infinitely scales up its difficulty and can be beaten over and over for greater rewards.'} buildTime: {type: 'number', description: 'How long it has taken to build this level.'} practice: { type: 'boolean' } + shareable: { type: 'boolean', title: 'Shareable' } practiceThresholdMinutes: {type: 'number', description: 'Players with larger playtimes may be directed to a practice level.'} # Admin flags diff --git a/app/views/editor/level/settings/SettingsTabView.coffee b/app/views/editor/level/settings/SettingsTabView.coffee index 56fe1609a..88951e2a5 100644 --- a/app/views/editor/level/settings/SettingsTabView.coffee +++ b/app/views/editor/level/settings/SettingsTabView.coffee @@ -16,6 +16,7 @@ module.exports = class SettingsTabView extends CocoView 'name', 'description', 'documentation', 'nextLevel', 'background', 'victory', 'i18n', 'icon', 'goals', 'type', 'terrain', 'showsGuide', 'banner', 'employerDescription', 'loadingTip', 'requiresSubscription', 'helpVideos', 'replayable', 'scoreTypes', 'concepts', 'picoCTFProblem', 'practice', 'practiceThresholdMinutes' + 'shareable' ] subscriptions: diff --git a/server/handlers/level_handler.coffee b/server/handlers/level_handler.coffee index 549d49a9c..eb82beade 100644 --- a/server/handlers/level_handler.coffee +++ b/server/handlers/level_handler.coffee @@ -39,6 +39,7 @@ LevelHandler = class LevelHandler extends Handler 'requiresSubscription' 'adventurer' 'practice' + 'shareable' 'adminOnly' 'disableSpaces' 'hidesSubmitUntilRun' diff --git a/server/middleware/classrooms.coffee b/server/middleware/classrooms.coffee index 36649413e..dec4ea591 100644 --- a/server/middleware/classrooms.coffee +++ b/server/middleware/classrooms.coffee @@ -154,7 +154,7 @@ module.exports = levels = _.sortBy(levels, 'campaignIndex') for level in levels levelData = { original: mongoose.Types.ObjectId(level.original) } - _.extend(levelData, _.pick(level, 'type', 'slug', 'name', 'practice', 'practiceThresholdMinutes')) + _.extend(levelData, _.pick(level, 'type', 'slug', 'name', 'practice', 'practiceThresholdMinutes', 'shareable')) courseData.levels.push(levelData) coursesData.push(courseData) classroom.set('courses', coursesData) From c3ed217964eaaf161f93ada1f0c95c4798b9bb0b Mon Sep 17 00:00:00 2001 From: phoenixeliot Date: Thu, 14 Jul 2016 16:20:15 -0700 Subject: [PATCH 2/2] Fix i18n render bug on SimulateTabView --- app/views/ladder/SimulateTabView.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/ladder/SimulateTabView.coffee b/app/views/ladder/SimulateTabView.coffee index 2be7ed186..d30c3f9b1 100644 --- a/app/views/ladder/SimulateTabView.coffee +++ b/app/views/ladder/SimulateTabView.coffee @@ -136,6 +136,7 @@ class SimulatorsLeaderboardData extends CocoClass return me.id in (user.id for user in @topSimulators.models) nearbySimulators: -> + return [] if not @playersAbove?.models l = [] above = @playersAbove.models l = l.concat(above)