mirror of https://github.com/Requarks/wiki.git
Nicolas Giard
6 years ago
26 changed files with 2292 additions and 1320 deletions
Unified View
Diff Options
-
4.babelrc
-
5client/client-app.js
-
30client/client-setup.js
-
141client/components/admin/admin-navigation.vue
-
2client/components/login.vue
-
55client/components/setup.vue
-
12client/graph/admin/navigation/navigation-mutation-save-tree.gql
-
12client/graph/admin/navigation/navigation-query-tree.gql
-
2client/helpers/compatibility.js
-
4client/index-app.js
-
7client/index-setup.js
-
34dev/templates/master.pug
-
64dev/templates/setup.pug
-
21dev/webpack/webpack.dev.js
-
21dev/webpack/webpack.prod.js
-
110package.json
-
7server/db/migrations/2.0.0.js
-
39server/graph/resolvers/navigation.js
-
51server/graph/schemas/navigation.graphql
-
8server/locales/default.json
-
7server/models/editors.js
-
27server/models/navigation.js
-
3server/setup.js
-
20server/views/master.pug
-
51server/views/setup.pug
-
2875yarn.lock
@ -0,0 +1,30 @@ |
|||||
|
/* eslint-disable import/first */ |
||||
|
import Vue from 'vue' |
||||
|
import Vuetify from 'vuetify' |
||||
|
import VeeValidate from 'vee-validate' |
||||
|
import boot from './modules/boot' |
||||
|
/* eslint-enable import/first */ |
||||
|
|
||||
|
window.WIKI = null |
||||
|
window.boot = boot |
||||
|
|
||||
|
Vue.use(Vuetify) |
||||
|
Vue.use(VeeValidate, { events: '' }) |
||||
|
|
||||
|
Vue.component('setup', () => import(/* webpackMode: "eager" */ './components/setup.vue')) |
||||
|
|
||||
|
let bootstrap = () => { |
||||
|
window.WIKI = new Vue({ |
||||
|
el: '#root' |
||||
|
}) |
||||
|
|
||||
|
// ====================================
|
||||
|
// Load Icons
|
||||
|
// ====================================
|
||||
|
|
||||
|
import(/* webpackChunkName: "icons" */ './svg/icons.svg').then(icons => { |
||||
|
document.body.insertAdjacentHTML('beforeend', icons.default) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
window.boot.onDOMReady(bootstrap) |
@ -0,0 +1,12 @@ |
|||||
|
mutation ($tree: [NavigationItemInput]!) { |
||||
|
navigation{ |
||||
|
updateTree(tree: $tree) { |
||||
|
responseResult { |
||||
|
succeeded |
||||
|
errorCode |
||||
|
slug |
||||
|
message |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
{ |
||||
|
navigation { |
||||
|
tree { |
||||
|
id |
||||
|
kind |
||||
|
label |
||||
|
icon |
||||
|
targetType |
||||
|
target |
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,9 +1,9 @@ |
|||||
'use strict' |
|
||||
|
require('@babel/polyfill') |
||||
|
|
||||
require('vuetify/src/stylus/main.styl') |
require('vuetify/src/stylus/main.styl') |
||||
require('./scss/app.scss') |
require('./scss/app.scss') |
||||
require('./themes/' + process.env.CURRENT_THEME + '/scss/app.scss') |
require('./themes/' + process.env.CURRENT_THEME + '/scss/app.scss') |
||||
|
|
||||
require('./helpers/compatibility.js') |
require('./helpers/compatibility.js') |
||||
require('./app.js') |
|
||||
|
require('./client-app.js') |
||||
require('./themes/' + process.env.CURRENT_THEME + '/js/app.js') |
require('./themes/' + process.env.CURRENT_THEME + '/js/app.js') |
@ -0,0 +1,7 @@ |
|||||
|
require('@babel/polyfill') |
||||
|
|
||||
|
require('vuetify/src/stylus/main.styl') |
||||
|
require('./scss/app.scss') |
||||
|
require('./helpers/compatibility.js') |
||||
|
|
||||
|
require('./client-setup.js') |
@ -0,0 +1,64 @@ |
|||||
|
doctype html |
||||
|
html |
||||
|
head |
||||
|
meta(http-equiv='X-UA-Compatible', content='IE=edge') |
||||
|
meta(charset='UTF-8') |
||||
|
meta(name='viewport', content='user-scalable=yes, width=device-width, initial-scale=1, maximum-scale=5') |
||||
|
meta(name='theme-color', content='#333333') |
||||
|
meta(name='msapplication-TileColor', content='#333333') |
||||
|
meta(name='msapplication-TileImage', content='/favicons/ms-icon-144x144.png') |
||||
|
title Wiki.js Setup |
||||
|
|
||||
|
//- Favicon |
||||
|
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180] |
||||
|
link(rel='apple-touch-icon', sizes=favsize + 'x' + favsize, href='/favicons/apple-icon-' + favsize + 'x' + favsize + '.png') |
||||
|
link(rel='icon', type='image/png', sizes='192x192', href='/favicons/android-icon-192x192.png') |
||||
|
each favsize in [32, 96, 16] |
||||
|
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png') |
||||
|
link(rel='manifest', href='/manifest.json') |
||||
|
|
||||
|
//- Site Lang |
||||
|
script. |
||||
|
var siteConfig = !{JSON.stringify({ title: config.title })} |
||||
|
|
||||
|
//- CSS |
||||
|
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Source+Code+Pro:400,700|Material+Icons') |
||||
|
link(type='text/css', rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css') |
||||
|
<% for (var index in htmlWebpackPlugin.files.css) { %> |
||||
|
<% if (htmlWebpackPlugin.files.cssIntegrity) { %> |
||||
|
link( |
||||
|
type='text/css' |
||||
|
rel='stylesheet' |
||||
|
href='<%= htmlWebpackPlugin.files.css[index] %>' |
||||
|
integrity='<%= htmlWebpackPlugin.files.cssIntegrity[index] %>' |
||||
|
crossorigin='<%= webpackConfig.output.crossOriginLoading %>' |
||||
|
) |
||||
|
<% } else { %> |
||||
|
link( |
||||
|
type='text/css' |
||||
|
rel='stylesheet' |
||||
|
href='<%= htmlWebpackPlugin.files.css[index] %>' |
||||
|
) |
||||
|
<% } %> |
||||
|
<% } %> |
||||
|
|
||||
|
//- JS |
||||
|
<% for (var index in htmlWebpackPlugin.files.js) { %> |
||||
|
<% if (htmlWebpackPlugin.files.cssIntegrity) { %> |
||||
|
script( |
||||
|
type='text/javascript' |
||||
|
src='<%= htmlWebpackPlugin.files.js[index] %>' |
||||
|
integrity='<%= htmlWebpackPlugin.files.jsIntegrity[index] %>' |
||||
|
crossorigin='<%= webpackConfig.output.crossOriginLoading %>' |
||||
|
) |
||||
|
<% } else { %> |
||||
|
script( |
||||
|
type='text/javascript' |
||||
|
src='<%= htmlWebpackPlugin.files.js[index] %>' |
||||
|
) |
||||
|
<% } %> |
||||
|
<% } %> |
||||
|
|
||||
|
body |
||||
|
#root |
||||
|
setup(telemetry-id=telemetryClientID, wiki-version=packageObj.version) |
@ -0,0 +1,39 @@ |
|||||
|
const _ = require('lodash') |
||||
|
const graphHelper = require('../../helpers/graph') |
||||
|
|
||||
|
/* global WIKI */ |
||||
|
|
||||
|
module.exports = { |
||||
|
Query: { |
||||
|
async navigation() { return {} } |
||||
|
}, |
||||
|
Mutation: { |
||||
|
async navigation() { return {} } |
||||
|
}, |
||||
|
NavigationQuery: { |
||||
|
async tree(obj, args, context, info) { |
||||
|
// let renderers = await WIKI.models.renderers.getRenderers()
|
||||
|
return [] |
||||
|
} |
||||
|
}, |
||||
|
NavigationMutation: { |
||||
|
async updateTree(obj, args, context) { |
||||
|
try { |
||||
|
// for (let rdr of args.renderers) {
|
||||
|
// await WIKI.models.storage.query().patch({
|
||||
|
// isEnabled: rdr.isEnabled,
|
||||
|
// config: _.reduce(rdr.config, (result, value, key) => {
|
||||
|
// _.set(result, `${value.key}`, value.value)
|
||||
|
// return result
|
||||
|
// }, {})
|
||||
|
// }).where('key', rdr.key)
|
||||
|
// }
|
||||
|
return { |
||||
|
responseResult: graphHelper.generateSuccess('Navigation updated successfully') |
||||
|
} |
||||
|
} catch (err) { |
||||
|
return graphHelper.generateError(err) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
# =============================================== |
||||
|
# NAVIGATION |
||||
|
# =============================================== |
||||
|
|
||||
|
extend type Query { |
||||
|
navigation: NavigationQuery |
||||
|
} |
||||
|
|
||||
|
extend type Mutation { |
||||
|
navigation: NavigationMutation |
||||
|
} |
||||
|
|
||||
|
# ----------------------------------------------- |
||||
|
# QUERIES |
||||
|
# ----------------------------------------------- |
||||
|
|
||||
|
type NavigationQuery { |
||||
|
tree: [NavigationItem]! |
||||
|
} |
||||
|
|
||||
|
# ----------------------------------------------- |
||||
|
# MUTATIONS |
||||
|
# ----------------------------------------------- |
||||
|
|
||||
|
type NavigationMutation { |
||||
|
updateTree( |
||||
|
tree: [NavigationItemInput]! |
||||
|
): DefaultResponse |
||||
|
} |
||||
|
|
||||
|
# ----------------------------------------------- |
||||
|
# TYPES |
||||
|
# ----------------------------------------------- |
||||
|
|
||||
|
type NavigationItem { |
||||
|
id: String! |
||||
|
kind: String! |
||||
|
label: String |
||||
|
icon: String |
||||
|
targetType: String |
||||
|
target: String |
||||
|
} |
||||
|
|
||||
|
input NavigationItemInput { |
||||
|
id: String! |
||||
|
kind: String! |
||||
|
label: String |
||||
|
icon: String |
||||
|
targetType: String |
||||
|
target: String |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
const Model = require('objection').Model |
||||
|
|
||||
|
/* global WIKI */ |
||||
|
|
||||
|
/** |
||||
|
* Navigation model |
||||
|
*/ |
||||
|
module.exports = class Navigation extends Model { |
||||
|
static get tableName() { return 'navigation' } |
||||
|
static get idColumn() { return 'key' } |
||||
|
|
||||
|
static get jsonSchema () { |
||||
|
return { |
||||
|
type: 'object', |
||||
|
required: ['key'], |
||||
|
|
||||
|
properties: { |
||||
|
key: {type: 'string'}, |
||||
|
config: {type: 'object'} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
static async getTree() { |
||||
|
return WIKI.models.navigation.query() |
||||
|
} |
||||
|
} |
@ -1,5 +1,48 @@ |
|||||
extends master.pug |
|
||||
|
doctype html |
||||
|
html |
||||
|
head |
||||
|
meta(http-equiv='X-UA-Compatible', content='IE=edge') |
||||
|
meta(charset='UTF-8') |
||||
|
meta(name='viewport', content='user-scalable=yes, width=device-width, initial-scale=1, maximum-scale=5') |
||||
|
meta(name='theme-color', content='#333333') |
||||
|
meta(name='msapplication-TileColor', content='#333333') |
||||
|
meta(name='msapplication-TileImage', content='/favicons/ms-icon-144x144.png') |
||||
|
title Wiki.js Setup |
||||
|
|
||||
block body |
|
||||
#root |
|
||||
setup(telemetry-id=telemetryClientID, wiki-version=packageObj.version) |
|
||||
|
//- Favicon |
||||
|
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180] |
||||
|
link(rel='apple-touch-icon', sizes=favsize + 'x' + favsize, href='/favicons/apple-icon-' + favsize + 'x' + favsize + '.png') |
||||
|
link(rel='icon', type='image/png', sizes='192x192', href='/favicons/android-icon-192x192.png') |
||||
|
each favsize in [32, 96, 16] |
||||
|
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png') |
||||
|
link(rel='manifest', href='/manifest.json') |
||||
|
|
||||
|
//- Site Lang |
||||
|
script. |
||||
|
var siteConfig = !{JSON.stringify({ title: config.title })} |
||||
|
|
||||
|
//- CSS |
||||
|
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Source+Code+Pro:400,700|Material+Icons') |
||||
|
link(type='text/css', rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css') |
||||
|
|
||||
|
|
||||
|
//- JS |
||||
|
|
||||
|
|
||||
|
script( |
||||
|
type='text/javascript' |
||||
|
src='/js/runtime.js' |
||||
|
) |
||||
|
|
||||
|
|
||||
|
|
||||
|
script( |
||||
|
type='text/javascript' |
||||
|
src='/js/setup.js' |
||||
|
) |
||||
|
|
||||
|
|
||||
|
|
||||
|
body |
||||
|
#root |
||||
|
setup(telemetry-id=telemetryClientID, wiki-version=packageObj.version) |
2875
yarn.lock
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save