feat: view page layout (wip) + footer component + fixes

This commit is contained in:
Nicolas Giard
2018-08-05 23:03:46 -04:00
parent 47dcc90fb7
commit 5620419d05
11 changed files with 139 additions and 50 deletions

View File

@@ -1,5 +1,8 @@
const express = require('express')
const router = express.Router()
const path = require('path')
/* global WIKI */
/**
* Create/Edit document
@@ -25,8 +28,17 @@ router.get(['/p', '/p/*'], (req, res, next) => {
/**
* View document
*/
router.get('/*', (req, res, next) => {
router.get('/', (req, res, next) => {
res.render('main/welcome')
})
/**
* View document
*/
router.get('/*', (req, res, next) => {
res.render(path.join(WIKI.ROOTPATH, 'themes/default/views/page'), {
basedir: path.join(WIKI.SERVERPATH, 'views')
})
})
module.exports = router

View File

@@ -1,4 +1,5 @@
const _ = require('lodash')
const chalk = require('chalk')
const cfgHelper = require('../helpers/config')
const fs = require('fs')
const path = require('path')
@@ -17,6 +18,8 @@ module.exports = {
dataRegex: path.join(WIKI.SERVERPATH, 'app/regex.js')
}
process.stdout.write(chalk.blue(`Loading configuration from ${confPaths.config}... `))
let appconfig = {}
let appdata = {}
@@ -28,8 +31,12 @@ module.exports = {
)
appdata = yaml.safeLoad(fs.readFileSync(confPaths.data, 'utf8'))
appdata.regex = require(confPaths.dataRegex)
} catch (ex) {
console.error(ex)
console.info(chalk.green.bold(`OK`))
} catch (err) {
console.error(chalk.red.bold(`FAILED`))
console.error(err.message)
console.error(chalk.red.bold(`>>> Unable to read configuration file! Did you create the config.yml file?`))
process.exit(1)
}

View File

@@ -1,9 +1,11 @@
const _ = require('lodash')
/* global WIKI */
module.exports = {
async init() {
WIKI.logger.info('=======================================')
WIKI.logger.info('= Wiki.js =============================')
WIKI.logger.info(`= Wiki.js ${_.padEnd(WIKI.version + ' ', 29, '=')}`)
WIKI.logger.info('=======================================')
WIKI.models = require('./db').init()
@@ -48,8 +50,9 @@ module.exports = {
*/
async postBootMaster() {
await WIKI.models.authentication.refreshStrategiesFromDisk()
await WIKI.auth.activateStrategies()
await WIKI.models.storage.refreshTargetsFromDisk()
await WIKI.auth.activateStrategies()
await WIKI.queue.start()
}
}

View File

@@ -270,6 +270,12 @@ module.exports = () => {
confRaw = yaml.safeDump(conf)
await fs.writeFileAsync(path.join(WIKI.ROOTPATH, 'config.yml'), confRaw)
// Create directory structure
await fs.ensureDir(conf.paths.data)
await fs.ensureDir(path.join(conf.paths.data, 'cache'))
await fs.ensureDir(path.join(conf.paths.data, 'temp-upload'))
await fs.ensureDir(conf.paths.content)
// Set config
_.set(WIKI.config, 'defaultEditor', 'markdown')
_.set(WIKI.config, 'graphEndpoint', 'https://graph.requarks.io')

View File

@@ -1,6 +1,5 @@
extends ../master.pug
block body
body
#app
admin
#app
admin