mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
Update article model
This commit is contained in:
parent
b6ae73ef29
commit
98b36d299c
3 changed files with 4 additions and 2 deletions
|
@ -25,7 +25,8 @@ module.exports = class DocsModal extends View
|
|||
@docs = specific.concat(general)
|
||||
marked.setOptions {gfm: true, sanitize: false, smartLists: true, breaks: false}
|
||||
@docs = _.cloneDeep(@docs)
|
||||
doc.html = marked(doc.body) for doc in @docs
|
||||
doc.html = marked(doc.i18n?[me.lang()]?.body or doc.body) for doc in @docs
|
||||
doc.name = (doc.i18n?[me.lang()]?.name or doc.name) for doc in @docs
|
||||
doc.slug = _.string.slugify(doc.name) for doc in @docs
|
||||
super()
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Handler = require('../commons/Handler')
|
|||
|
||||
ArticleHandler = class ArticleHandler extends Handler
|
||||
modelClass: Article
|
||||
editableProperties: ['body', 'name']
|
||||
editableProperties: ['body', 'name', 'i18n']
|
||||
|
||||
hasAccess: (req) ->
|
||||
req.method is 'GET' or req.user?.isAdmin()
|
||||
|
|
|
@ -4,6 +4,7 @@ ArticleSchema = c.object()
|
|||
c.extendNamedProperties ArticleSchema # name first
|
||||
|
||||
ArticleSchema.properties.body = { type: 'string', title: 'Content', format: 'markdown' }
|
||||
ArticleSchema.properties.i18n = { type: 'object', title: 'i18n', format: 'i18n', props: ['body'] }
|
||||
|
||||
c.extendBasicProperties(ArticleSchema, 'article')
|
||||
c.extendSearchableProperties(ArticleSchema)
|
||||
|
|
Loading…
Reference in a new issue