fix: setup editors add + page view responsive

This commit is contained in:
Nicolas Giard
2018-08-10 21:00:20 -04:00
parent 2f26d731fc
commit a78c6505f0
6 changed files with 59 additions and 14 deletions

View File

@@ -44,9 +44,8 @@ exports.up = knex => {
.createTable('editors', table => {
table.increments('id').primary()
table.string('key').notNullable().unique()
table.string('title').notNullable()
table.boolean('isEnabled').notNullable().defaultTo(false)
table.jsonb('config')
table.jsonb('config').notNullable()
})
// GROUPS ------------------------------
.createTable('groups', table => {

View File

@@ -36,10 +36,10 @@ module.exports = class Editor extends Model {
const dbEditors = await WIKI.models.editors.query()
// -> Fetch definitions from disk
const editorDirs = await fs.readdir(path.join(WIKI.SERVERPATH, 'modules/editors'))
const editorDirs = await fs.readdir(path.join(WIKI.SERVERPATH, 'modules/editor'))
let diskEditors = []
for (let dir of editorDirs) {
const def = await fs.readFile(path.join(WIKI.SERVERPATH, 'modules/editors', dir, 'definition.yml'), 'utf8')
const def = await fs.readFile(path.join(WIKI.SERVERPATH, 'modules/editor', dir, 'definition.yml'), 'utf8')
diskEditors.push(yaml.safeLoad(def))
}
WIKI.data.editors = diskEditors.map(editor => ({
@@ -72,7 +72,7 @@ module.exports = class Editor extends Model {
}
}
if (newEditors.length > 0) {
await WIKI.models.storage.query().insert(newEditors)
await WIKI.models.editors.query().insert(newEditors)
WIKI.logger.info(`Loaded ${newEditors.length} new editors: [ OK ]`)
} else {
WIKI.logger.info(`No new editors found: [ SKIPPED ]`)