Add achievement hidden property

This commit is contained in:
Matt Lott 2016-08-24 07:37:08 -07:00
parent d9b688c5b8
commit 22e3f445c0
4 changed files with 5 additions and 0 deletions

View file

@ -81,6 +81,7 @@ _.extend AchievementSchema.properties,
additionalProperties: false additionalProperties: false
i18n: {type: 'object', format: 'i18n', props: ['name', 'description'], description: 'Help translate this achievement'} i18n: {type: 'object', format: 'i18n', props: ['name', 'description'], description: 'Help translate this achievement'}
rewards: c.RewardSchema 'awarded by this achievement' rewards: c.RewardSchema 'awarded by this achievement'
hidden: {type: 'boolean', description: 'Hide achievement from user if true'}
_.extend AchievementSchema, # Let's have these on the bottom _.extend AchievementSchema, # Let's have these on the bottom

View file

@ -50,6 +50,8 @@ block modal-body-content
if level.isType('hero', 'hero-ladder', 'game-dev', 'web-dev') if level.isType('hero', 'hero-ladder', 'game-dev', 'web-dev')
for achievement in achievements for achievement in achievements
if achievement.get('hidden')
- continue;
- var animate = achievement.completed && !achievement.completedAWhileAgo - var animate = achievement.completed && !achievement.completedAWhileAgo
.achievement-panel(class=achievement.completedAWhileAgo ? 'earned' : '' data-achievement-id=achievement.id data-animate=animate) .achievement-panel(class=achievement.completedAWhileAgo ? 'earned' : '' data-achievement-id=achievement.id data-animate=animate)
- var rewards = achievement.get('rewards') || {}; - var rewards = achievement.get('rewards') || {};

View file

@ -45,6 +45,7 @@ module.exports = class RootView extends CocoView
return if achievement.get('collection') is 'level.sessions' and not achievement.get('query')?.team return if achievement.get('collection') is 'level.sessions' and not achievement.get('query')?.team
#return if @isIE() # Some bugs in IE right now, TODO fix soon! # Maybe working now with not caching achievement fetches in CocoModel? #return if @isIE() # Some bugs in IE right now, TODO fix soon! # Maybe working now with not caching achievement fetches in CocoModel?
return if window.serverConfig.picoCTF return if window.serverConfig.picoCTF
return if achievement.get('hidden')
new AchievementPopup achievement: achievement, earnedAchievement: earnedAchievement new AchievementPopup achievement: achievement, earnedAchievement: earnedAchievement
handleNewAchievements: (e) -> handleNewAchievements: (e) ->

View file

@ -91,6 +91,7 @@ AchievementSchema.statics.editableProperties = [
'rewards' 'rewards'
'i18n' 'i18n'
'i18nCoverage' 'i18nCoverage'
'hidden'
] ]
AchievementSchema.statics.jsonSchema = require '../../app/schemas/models/achievement' AchievementSchema.statics.jsonSchema = require '../../app/schemas/models/achievement'