|
|
@ -51,6 +51,10 @@ module.exports = class Page extends Model {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static get jsonAttributes() {
|
|
|
|
|
|
|
|
return ['extra']
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static get relationMappings() {
|
|
|
|
static get relationMappings() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
tags: {
|
|
|
|
tags: {
|
|
|
@ -139,6 +143,10 @@ module.exports = class Page extends Model {
|
|
|
|
title: 'string'
|
|
|
|
title: 'string'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
extra: {
|
|
|
|
|
|
|
|
js: 'string',
|
|
|
|
|
|
|
|
css: 'string'
|
|
|
|
|
|
|
|
},
|
|
|
|
title: 'string',
|
|
|
|
title: 'string',
|
|
|
|
toc: 'string',
|
|
|
|
toc: 'string',
|
|
|
|
updatedAt: 'string'
|
|
|
|
updatedAt: 'string'
|
|
|
@ -248,7 +256,7 @@ module.exports = class Page extends Model {
|
|
|
|
throw new WIKI.Error.PageEmptyContent()
|
|
|
|
throw new WIKI.Error.PageEmptyContent()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -> Format JS Scripts
|
|
|
|
// -> Format CSS Scripts
|
|
|
|
let scriptCss = ''
|
|
|
|
let scriptCss = ''
|
|
|
|
if (WIKI.auth.checkAccess(opts.user, ['write:styles'], {
|
|
|
|
if (WIKI.auth.checkAccess(opts.user, ['write:styles'], {
|
|
|
|
locale: opts.locale,
|
|
|
|
locale: opts.locale,
|
|
|
@ -375,7 +383,7 @@ module.exports = class Page extends Model {
|
|
|
|
ogPage.extra = {}
|
|
|
|
ogPage.extra = {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -> Format JS Scripts
|
|
|
|
// -> Format CSS Scripts
|
|
|
|
let scriptCss = _.get(ogPage, 'extra.css', '')
|
|
|
|
let scriptCss = _.get(ogPage, 'extra.css', '')
|
|
|
|
if (WIKI.auth.checkAccess(opts.user, ['write:styles'], {
|
|
|
|
if (WIKI.auth.checkAccess(opts.user, ['write:styles'], {
|
|
|
|
locale: opts.locale,
|
|
|
|
locale: opts.locale,
|
|
|
@ -787,6 +795,7 @@ module.exports = class Page extends Model {
|
|
|
|
'pages.localeCode',
|
|
|
|
'pages.localeCode',
|
|
|
|
'pages.authorId',
|
|
|
|
'pages.authorId',
|
|
|
|
'pages.creatorId',
|
|
|
|
'pages.creatorId',
|
|
|
|
|
|
|
|
'pages.extra',
|
|
|
|
{
|
|
|
|
{
|
|
|
|
authorName: 'author.name',
|
|
|
|
authorName: 'author.name',
|
|
|
|
authorEmail: 'author.email',
|
|
|
|
authorEmail: 'author.email',
|
|
|
@ -846,6 +855,10 @@ module.exports = class Page extends Model {
|
|
|
|
creatorId: page.creatorId,
|
|
|
|
creatorId: page.creatorId,
|
|
|
|
creatorName: page.creatorName,
|
|
|
|
creatorName: page.creatorName,
|
|
|
|
description: page.description,
|
|
|
|
description: page.description,
|
|
|
|
|
|
|
|
extra: {
|
|
|
|
|
|
|
|
css: page.extra ? page.extra.css : '',
|
|
|
|
|
|
|
|
js: page.extra ? page.extra.js : ''
|
|
|
|
|
|
|
|
},
|
|
|
|
isPrivate: page.isPrivate === 1 || page.isPrivate === true,
|
|
|
|
isPrivate: page.isPrivate === 1 || page.isPrivate === true,
|
|
|
|
isPublished: page.isPublished === 1 || page.isPublished === true,
|
|
|
|
isPublished: page.isPublished === 1 || page.isPublished === true,
|
|
|
|
publishEndDate: page.publishEndDate,
|
|
|
|
publishEndDate: page.publishEndDate,
|
|
|
|