feat: content rendering improvements + save fix

This commit is contained in:
Nicolas Giard
2018-11-10 23:40:55 -05:00
parent 91b79dfa1f
commit 0b5a4e0c63
16 changed files with 125 additions and 48 deletions

View File

@@ -37,6 +37,15 @@ module.exports = {
case 'mariadb':
case 'mysql':
dbClient = 'mysql2'
// Fix mysql boolean handling...
dbConfig.typeCast = (field, next) => {
if (field.type === 'TINY' && field.length === 1) {
let value = field.string()
return value ? (value === '1') : null
}
return next()
}
break
case 'mssql':
dbClient = 'mssql'

View File

@@ -4,6 +4,7 @@ const getos = Promise.promisify(require('getos'))
const os = require('os')
const filesize = require('filesize')
const path = require('path')
const fs = require('fs-extra')
/* global WIKI */
@@ -76,6 +77,10 @@ module.exports = {
const osInfo = await getos()
osLabel = `${os.type()} - ${osInfo.dist} (${osInfo.codename || os.platform()}) ${osInfo.release || os.release()} ${os.arch()}`
}
const isDockerized = await fs.pathExists('/.dockerenv')
if (isDockerized) {
osLabel = `${osLabel} (Docker Container)`
}
return osLabel
},
hostname() {

View File

@@ -23,6 +23,7 @@ module.exports = class PageHistory extends Model {
publishStartDate: {type: 'string'},
publishEndDate: {type: 'string'},
content: {type: 'string'},
contentType: {type: 'string'},
createdAt: {type: 'string'}
}
@@ -87,6 +88,7 @@ module.exports = class PageHistory extends Model {
pageId: opts.id,
authorId: opts.authorId,
content: opts.content,
contentType: opts.contentType,
description: opts.description,
editorKey: opts.editorKey,
hash: opts.hash,

View File

@@ -4,6 +4,7 @@ block body
#root
v-app
editor(
:page-id=page.id
locale=page.localeCode
path=page.path
title=page.title

View File

@@ -14,6 +14,6 @@ block body
updated-at=page.updatedAt
author-name=page.authorName
:author-id=page.authorId
is-published=page.isPublished
:is-published=page.isPublished
)
template(slot='contents')!= page.render