Commit db8e598e authored by Nicolas Giard's avatar Nicolas Giard

feat: page display + renderers reorg

parent 4bb522f9
......@@ -59,7 +59,7 @@
height: 250px;
margin-bottom: 3rem;
z-index: 2;
animation-duration: 3s;
animation-duration: 2s;
@include until($tablet) {
height: 200px;
......
......@@ -37,8 +37,10 @@
v-breadcrumbs-item Galaxy
v-breadcrumbs-item Solar System
v-breadcrumbs-item Planet Earth
v-spacer
status-indicator(active, pulse)
template(v-if='!isPublished')
v-spacer
.caption.red--text Unpublished
status-indicator.ml-3(negative, pulse)
v-divider
v-layout(row)
v-flex(xs12, lg9, xl10)
......@@ -53,11 +55,11 @@
v-toolbar(color='grey lighten-4', flat, :height='90')
div
.caption.grey--text.text--lighten-1 Last edited by
.body-2.grey--text.text--darken-3 John Doe
.caption.grey--text.text--darken-1 Monday at 12:34 PM
.body-2.grey--text.text--darken-3 {{ authorName }}
.caption.grey--text.text--darken-1 {{ updatedAt | moment('calendar') }}
v-spacer
v-tooltip(bottom)
v-btn(icon, slot='activator')
v-tooltip(left)
v-btn(icon, slot='activator', :href='"/e/" + path')
v-icon(color='grey') edit
span Edit Page
v-divider
......@@ -81,9 +83,15 @@
v-divider
v-toolbar(color='grey lighten-3', flat, dense)
v-spacer
v-btn(icon): v-icon(color='grey') bookmark
v-btn(icon): v-icon(color='grey') share
v-btn(icon): v-icon(color='grey') print
v-tooltip(bottom)
v-btn(icon, slot='activator'): v-icon(color='grey') bookmark
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
nav-footer
</template>
......@@ -96,6 +104,14 @@ export default {
StatusIndicator
},
props: {
locale: {
type: String,
default: 'en'
},
path: {
type: String,
default: 'home'
},
title: {
type: String,
default: 'Untitled Page'
......@@ -103,6 +119,30 @@ export default {
description: {
type: String,
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() {
......
......@@ -33,10 +33,11 @@ router.get('/*', async (req, res, next) => {
const page = await WIKI.models.pages.getPage({
path: pageArgs.path,
locale: pageArgs.locale,
userId: req.user.id
userId: req.user.id,
private: false
})
if (page) {
res.render('page')
res.render('page', { page })
} else if (pageArgs.path === 'home') {
res.render('welcome')
} else {
......
......@@ -50,6 +50,7 @@ module.exports = {
*/
async postBootMaster() {
await WIKI.models.authentication.refreshStrategiesFromDisk()
await WIKI.models.editors.refreshEditorsFromDisk()
await WIKI.models.storage.refreshTargetsFromDisk()
await WIKI.auth.activateStrategies()
......
......@@ -96,6 +96,13 @@ exports.up = knex => {
table.string('createdAt').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 ----------------------------
.createTable('settings', table => {
table.increments('id').primary()
......@@ -108,7 +115,7 @@ exports.up = knex => {
table.increments('id').primary()
table.string('key').notNullable().unique()
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')
})
// TAGS --------------------------------
......
......@@ -2,6 +2,8 @@ require('../core/worker')
/* global WIKI */
WIKI.models = require('../core/db').init()
module.exports = async (job) => {
WIKI.logger.info(`Rendering page ${job.data.path}...`)
......
......@@ -116,7 +116,7 @@ module.exports = class Page extends Model {
authorId: opts.authorId,
content: opts.content,
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,
editorKey: opts.editor,
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