From 8f7e4e22785002a3efc2503908a213994beb7f58 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Wed, 25 May 2016 15:29:57 -0700 Subject: [PATCH] Add hints to level schema, I18N editor --- app/schemas/models/level.coffee | 9 ++++++++- app/views/i18n/I18NEditLevelView.coffee | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/schemas/models/level.coffee b/app/schemas/models/level.coffee index 0d7148026..70930526b 100644 --- a/app/schemas/models/level.coffee +++ b/app/schemas/models/level.coffee @@ -276,9 +276,16 @@ c.extendNamedProperties LevelSchema # let's have the name be the first property _.extend LevelSchema.properties, description: {title: 'Description', description: 'A short explanation of what this level is about.', type: 'string', maxLength: 65536, format: 'markdown'} loadingTip: { type: 'string', title: 'Loading Tip', description: 'What to show for this level while it\'s loading.' } - documentation: c.object {title: 'Documentation', description: 'Documentation articles relating to this level.', required: ['specificArticles', 'generalArticles'], 'default': {specificArticles: [], generalArticles: []}}, + documentation: c.object {title: 'Documentation', description: 'Documentation articles relating to this level.', 'default': {specificArticles: [], generalArticles: []}}, specificArticles: c.array {title: 'Specific Articles', description: 'Specific documentation articles that live only in this level.', uniqueItems: true }, SpecificArticleSchema generalArticles: c.array {title: 'General Articles', description: 'General documentation articles that can be linked from multiple levels.', uniqueItems: true}, GeneralArticleSchema + hints: c.array {title: 'Hints', description: 'Hints that will be gradually revealed to the player.', uniqueItems: true }, { + type: 'object' + properties: { + body: {type: 'string', title: 'Content', description: 'The body content of the article, in Markdown.', format: 'markdown'} + i18n: {type: 'object', format: 'i18n', props: ['body'], description: 'Help translate this hint'} + } + } background: c.objectId({format: 'hidden'}) nextLevel: { type: 'object', diff --git a/app/views/i18n/I18NEditLevelView.coffee b/app/views/i18n/I18NEditLevelView.coffee index bb797ca73..6a333ab09 100644 --- a/app/views/i18n/I18NEditLevelView.coffee +++ b/app/views/i18n/I18NEditLevelView.coffee @@ -29,6 +29,12 @@ module.exports = class I18NEditLevelView extends I18NEditModelView @wrapRow 'Guide article name', ['name'], doc.name, i18n[lang]?.name, ['documentation', 'specificArticles', index] @wrapRow "'#{doc.name}' body", ['body'], doc.body, i18n[lang]?.body, ['documentation', 'specificArticles', index], 'markdown' + # hints + for hint, index in @model.get('documentation')?.hints ? [] + if i18n = hint.i18n + name = "Hint #{index+1}" + @wrapRow "'#{name}' body", ['body'], hint.body, i18n[lang]?.body, ['documentation', 'hints', index], 'markdown' + # sprite dialogues for script, scriptIndex in @model.get('scripts') ? [] for noteGroup, noteGroupIndex in script.noteChain ? []