Merge pull request #497 from M-r-A/master

Update article model
This commit is contained in:
Nick Winter 2014-03-07 17:20:01 -08:00
commit ba5518eda6
3 changed files with 4 additions and 2 deletions

View file

@ -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()

View file

@ -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()

View file

@ -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)