Skip to content

Commit

Permalink
feat: page display + renderers reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Aug 20, 2018
1 parent 4bb522f commit db8e598
Show file tree
Hide file tree
Showing 36 changed files with 241 additions and 52 deletions.
2 changes: 1 addition & 1 deletion client/scss/pages/_new.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
height: 250px;
margin-bottom: 3rem;
z-index: 2;
animation-duration: 3s;
animation-duration: 2s;

@include until($tablet) {
height: 200px;
Expand Down
58 changes: 49 additions & 9 deletions client/themes/default/components/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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>
Expand All @@ -96,13 +104,45 @@ export default {
StatusIndicator
},
props: {
locale: {
type: String,
default: 'en'
},
path: {
type: String,
default: 'home'
},
title: {
type: String,
default: 'Untitled Page'
},
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() {
Expand Down
5 changes: 3 additions & 2 deletions server/controllers/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions server/core/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 8 additions & 1 deletion server/db/migrations/2.0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 --------------------------------
Expand Down
2 changes: 2 additions & 0 deletions server/jobs/render-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}...`)

Expand Down
2 changes: 1 addition & 1 deletion server/models/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions server/modules/renderer/html-asciinema/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
1 change: 1 addition & 0 deletions server/modules/renderer/html-asciinema/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
7 changes: 7 additions & 0 deletions server/modules/renderer/html-blockquotes/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
1 change: 1 addition & 0 deletions server/modules/renderer/html-blockquotes/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
7 changes: 7 additions & 0 deletions server/modules/renderer/html-mathjax/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
File renamed without changes.
7 changes: 7 additions & 0 deletions server/modules/renderer/html-mediaplayers/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
1 change: 1 addition & 0 deletions server/modules/renderer/html-mediaplayers/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
7 changes: 7 additions & 0 deletions server/modules/renderer/html-security/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
1 change: 1 addition & 0 deletions server/modules/renderer/html-security/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
7 changes: 7 additions & 0 deletions server/modules/renderer/markdown-abbr/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownAbbr
title: Abbreviations
description: Parse abbreviations into abbr tags
author: requarks.io
dependsOn:
- markdownCore
props: {}
29 changes: 29 additions & 0 deletions server/modules/renderer/markdown-core/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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
1 change: 1 addition & 0 deletions server/modules/renderer/markdown-core/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
7 changes: 7 additions & 0 deletions server/modules/renderer/markdown-emoji/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownEmoji
title: Emoji
description: Convert tags to emojis
author: requarks.io
dependsOn:
- markdownCore
props: {}
File renamed without changes.
7 changes: 7 additions & 0 deletions server/modules/renderer/markdown-expandtabs/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownExpandtabs
title: Expand Tabs
description: Replace tabs with spaces in code blocks
author: requarks.io
dependsOn:
- markdownCore
props: {}
7 changes: 7 additions & 0 deletions server/modules/renderer/markdown-footnotes/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownFootnotes
title: Footnotes
description: Parse footnotes references
author: requarks.io
dependsOn:
- markdownCore
props: {}
7 changes: 7 additions & 0 deletions server/modules/renderer/markdown-mathjax/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownMathjax
title: Mathjax Pre-Processor
description: Pre-parse TeX blocks for Mathjax
author: requarks.io
dependsOn:
- markdownCore
props: {}
File renamed without changes.
7 changes: 7 additions & 0 deletions server/modules/renderer/markdown-mermaid/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownMermaid
title: Mermaid
description: Generate flowcharts from Mermaid syntax
author: requarks.io
dependsOn:
- markdownCore
props: {}
1 change: 1 addition & 0 deletions server/modules/renderer/markdown-mermaid/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
7 changes: 7 additions & 0 deletions server/modules/renderer/markdown-plantuml/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownPlantuml
title: PlantUML
description: Generate diagrams from PlantUML syntax
author: requarks.io
dependsOn:
- markdownCore
props: {}
1 change: 1 addition & 0 deletions server/modules/renderer/markdown-plantuml/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
7 changes: 7 additions & 0 deletions server/modules/renderer/markdown-tasklists/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
key: markdownTasklists
title: Task Lists
description: Parse task lists to checkboxes
author: requarks.io
dependsOn:
- markdownCore
props: {}
Loading

0 comments on commit db8e598

Please sign in to comment.