Commit db8e598e authored by Nicolas Giard's avatar Nicolas Giard

feat: page display + renderers reorg

parent 4bb522f9
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
height: 250px; height: 250px;
margin-bottom: 3rem; margin-bottom: 3rem;
z-index: 2; z-index: 2;
animation-duration: 3s; animation-duration: 2s;
@include until($tablet) { @include until($tablet) {
height: 200px; height: 200px;
......
...@@ -37,8 +37,10 @@ ...@@ -37,8 +37,10 @@
v-breadcrumbs-item Galaxy v-breadcrumbs-item Galaxy
v-breadcrumbs-item Solar System v-breadcrumbs-item Solar System
v-breadcrumbs-item Planet Earth v-breadcrumbs-item Planet Earth
v-spacer template(v-if='!isPublished')
status-indicator(active, pulse) v-spacer
.caption.red--text Unpublished
status-indicator.ml-3(negative, pulse)
v-divider v-divider
v-layout(row) v-layout(row)
v-flex(xs12, lg9, xl10) v-flex(xs12, lg9, xl10)
...@@ -53,11 +55,11 @@ ...@@ -53,11 +55,11 @@
v-toolbar(color='grey lighten-4', flat, :height='90') v-toolbar(color='grey lighten-4', flat, :height='90')
div div
.caption.grey--text.text--lighten-1 Last edited by .caption.grey--text.text--lighten-1 Last edited by
.body-2.grey--text.text--darken-3 John Doe .body-2.grey--text.text--darken-3 {{ authorName }}
.caption.grey--text.text--darken-1 Monday at 12:34 PM .caption.grey--text.text--darken-1 {{ updatedAt | moment('calendar') }}
v-spacer v-spacer
v-tooltip(bottom) v-tooltip(left)
v-btn(icon, slot='activator') v-btn(icon, slot='activator', :href='"/e/" + path')
v-icon(color='grey') edit v-icon(color='grey') edit
span Edit Page span Edit Page
v-divider v-divider
...@@ -81,9 +83,15 @@ ...@@ -81,9 +83,15 @@
v-divider v-divider
v-toolbar(color='grey lighten-3', flat, dense) v-toolbar(color='grey lighten-3', flat, dense)
v-spacer v-spacer
v-btn(icon): v-icon(color='grey') bookmark v-tooltip(bottom)
v-btn(icon): v-icon(color='grey') share v-btn(icon, slot='activator'): v-icon(color='grey') bookmark
v-btn(icon): v-icon(color='grey') print span Bookmark
v-tooltip(bottom)
v-btn(icon, slot='activator'): v-icon(color='grey') share
span Share
v-tooltip(bottom)
v-btn(icon, slot='activator'): v-icon(color='grey') print
span Print Format
v-spacer v-spacer
nav-footer nav-footer
</template> </template>
...@@ -96,6 +104,14 @@ export default { ...@@ -96,6 +104,14 @@ export default {
StatusIndicator StatusIndicator
}, },
props: { props: {
locale: {
type: String,
default: 'en'
},
path: {
type: String,
default: 'home'
},
title: { title: {
type: String, type: String,
default: 'Untitled Page' default: 'Untitled Page'
...@@ -103,6 +119,30 @@ export default { ...@@ -103,6 +119,30 @@ export default {
description: { description: {
type: String, type: String,
default: '' default: ''
},
createdAt: {
type: String,
default: ''
},
updatedAt: {
type: String,
default: ''
},
tags: {
type: Array,
default: () => ([])
},
authorName: {
type: String,
default: 'Unknown'
},
authorId: {
type: Number,
default: 0
},
isPublished: {
type: Boolean,
default: false
} }
}, },
data() { data() {
......
...@@ -33,10 +33,11 @@ router.get('/*', async (req, res, next) => { ...@@ -33,10 +33,11 @@ router.get('/*', async (req, res, next) => {
const page = await WIKI.models.pages.getPage({ const page = await WIKI.models.pages.getPage({
path: pageArgs.path, path: pageArgs.path,
locale: pageArgs.locale, locale: pageArgs.locale,
userId: req.user.id userId: req.user.id,
private: false
}) })
if (page) { if (page) {
res.render('page') res.render('page', { page })
} else if (pageArgs.path === 'home') { } else if (pageArgs.path === 'home') {
res.render('welcome') res.render('welcome')
} else { } else {
......
...@@ -50,6 +50,7 @@ module.exports = { ...@@ -50,6 +50,7 @@ module.exports = {
*/ */
async postBootMaster() { async postBootMaster() {
await WIKI.models.authentication.refreshStrategiesFromDisk() await WIKI.models.authentication.refreshStrategiesFromDisk()
await WIKI.models.editors.refreshEditorsFromDisk()
await WIKI.models.storage.refreshTargetsFromDisk() await WIKI.models.storage.refreshTargetsFromDisk()
await WIKI.auth.activateStrategies() await WIKI.auth.activateStrategies()
......
...@@ -96,6 +96,13 @@ exports.up = knex => { ...@@ -96,6 +96,13 @@ exports.up = knex => {
table.string('createdAt').notNullable() table.string('createdAt').notNullable()
table.string('updatedAt').notNullable() table.string('updatedAt').notNullable()
}) })
// STORAGE -----------------------------
.createTable('renderers', table => {
table.increments('id').primary()
table.string('key').notNullable().unique()
table.boolean('isEnabled').notNullable().defaultTo(false)
table.json('config')
})
// SETTINGS ---------------------------- // SETTINGS ----------------------------
.createTable('settings', table => { .createTable('settings', table => {
table.increments('id').primary() table.increments('id').primary()
...@@ -108,7 +115,7 @@ exports.up = knex => { ...@@ -108,7 +115,7 @@ exports.up = knex => {
table.increments('id').primary() table.increments('id').primary()
table.string('key').notNullable().unique() table.string('key').notNullable().unique()
table.boolean('isEnabled').notNullable().defaultTo(false) table.boolean('isEnabled').notNullable().defaultTo(false)
table.enum('mode', ['sync', 'push', 'pull']).notNullable().defaultTo('push') table.string('mode', ['sync', 'push', 'pull']).notNullable().defaultTo('push')
table.json('config') table.json('config')
}) })
// TAGS -------------------------------- // TAGS --------------------------------
......
...@@ -2,6 +2,8 @@ require('../core/worker') ...@@ -2,6 +2,8 @@ require('../core/worker')
/* global WIKI */ /* global WIKI */
WIKI.models = require('../core/db').init()
module.exports = async (job) => { module.exports = async (job) => {
WIKI.logger.info(`Rendering page ${job.data.path}...`) WIKI.logger.info(`Rendering page ${job.data.path}...`)
......
...@@ -116,7 +116,7 @@ module.exports = class Page extends Model { ...@@ -116,7 +116,7 @@ module.exports = class Page extends Model {
authorId: opts.authorId, authorId: opts.authorId,
content: opts.content, content: opts.content,
creatorId: opts.authorId, creatorId: opts.authorId,
contentType: _.get(WIKI.data.editors, `${opts.editor}.contentType`, 'text'), contentType: _.get(_.find(WIKI.data.editors, ['key', opts.editor]), `contentType`, 'text'),
description: opts.description, description: opts.description,
editorKey: opts.editor, editorKey: opts.editor,
isPrivate: opts.isPrivate, isPrivate: opts.isPrivate,
......
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownCore
title: Core
description: Basic Markdown Parser
author: requarks.io
dependsOn: []
props:
linkify:
type: Boolean
default: true
title: Automatically convert links
hint: Links will automatically be converted to clickable links.
linebreaks:
type: Boolean
default: true
title: Automatically convert line breaks
hint: Add linebreaks within paragraphs.
highlightCode:
type: Boolean
default: true
title: Highlight code blocks
hint: Add syntax coloring to code blocks.
codeTheme:
type: String
default: light
title: Code Color Theme
hint: Color theme for code blocks
enum:
- light
- dark
key: markdownEmoji
title: Emoji
description: Convert tags to emojis
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownExpandtabs
title: Expand Tabs
description: Replace tabs with spaces in code blocks
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownFootnotes
title: Footnotes
description: Parse footnotes references
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownMathjax
title: Mathjax Pre-Processor
description: Pre-parse TeX blocks for Mathjax
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownMermaid
title: Mermaid
description: Generate flowcharts from Mermaid syntax
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownPlantuml
title: PlantUML
description: Generate diagrams from PlantUML syntax
author: requarks.io
dependsOn:
- markdownCore
props: {}
key: markdownTasklists
title: Task Lists
description: Parse task lists to checkboxes
author: requarks.io
dependsOn:
- markdownCore
props: {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment