From 0ccdf10c9dccf321177736c58b8f2788f61ab648 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Wed, 28 Feb 2018 00:54:09 -0500 Subject: [PATCH] feat: admin component --- client/app.js | 3 + client/components/admin-dashboard.vue | 19 +++++ client/components/admin-general.vue | 38 +++++++++ client/components/admin.vue | 115 ++++++++++++++++++++++++++ client/components/editor-code.vue | 60 +++++++++++--- client/components/editor.vue | 4 +- client/scss/base/base.scss | 31 +++---- package.json | 1 + server/controllers/common.js | 7 ++ server/views/main/admin.pug | 6 ++ yarn.lock | 4 + 11 files changed, 255 insertions(+), 33 deletions(-) create mode 100644 client/components/admin-dashboard.vue create mode 100644 client/components/admin-general.vue create mode 100644 client/components/admin.vue create mode 100644 server/views/main/admin.pug diff --git a/client/app.js b/client/app.js index 086f94fc..8f8e7130 100644 --- a/client/app.js +++ b/client/app.js @@ -5,6 +5,7 @@ import CONSTANTS from './constants' import Vue from 'vue' +import VueRouter from 'vue-router' import VueClipboards from 'vue-clipboards' import VueSimpleBreakpoints from 'vue-simple-breakpoints' import VeeValidate from 'vee-validate' @@ -79,6 +80,7 @@ window.graphQL = new ApolloClient({ // Initialize Vue Modules // ==================================== +Vue.use(VueRouter) Vue.use(VueClipboards) Vue.use(VueSimpleBreakpoints) Vue.use(localization.VueI18Next) @@ -102,6 +104,7 @@ Vue.prototype.Velocity = Velocity // Register Vue Components // ==================================== +Vue.component('admin', () => import(/* webpackChunkName: "admin" */ './components/admin.vue')) Vue.component('editor', () => import(/* webpackChunkName: "editor" */ './components/editor.vue')) Vue.component('login', () => import(/* webpackMode: "eager" */ './components/login.vue')) Vue.component('navigator', () => import(/* webpackMode: "eager" */ './components/navigator.vue')) diff --git a/client/components/admin-dashboard.vue b/client/components/admin-dashboard.vue new file mode 100644 index 00000000..18735d56 --- /dev/null +++ b/client/components/admin-dashboard.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/client/components/admin-general.vue b/client/components/admin-general.vue new file mode 100644 index 00000000..90954d7e --- /dev/null +++ b/client/components/admin-general.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/client/components/admin.vue b/client/components/admin.vue new file mode 100644 index 00000000..81bad056 --- /dev/null +++ b/client/components/admin.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/client/components/editor-code.vue b/client/components/editor-code.vue index 0fa18082..e3911516 100644 --- a/client/components/editor-code.vue +++ b/client/components/editor-code.vue @@ -5,7 +5,7 @@ v-toolbar-title.white--text Sample Page .editor-code-toolbar .editor-code-toolbar-group - .editor-code-toolbar-item + .editor-code-toolbar-item(@click='toggleAround("**", "**")') svg.icons.is-18(role='img') title Bold use(xlink:href='#fa-bold') @@ -90,6 +90,11 @@ diff --git a/client/components/editor.vue b/client/components/editor.vue index b88d0933..8d36a62b 100644 --- a/client/components/editor.vue +++ b/client/components/editor.vue @@ -16,8 +16,8 @@ import _ from 'lodash' export default { components: { editorCode: () => import(/* webpackChunkName: "editor-code" */ './editor-code.vue'), - editorModalAccess: () => import(/* webpackChunkName: "editor-common" */ './editor-modal-access.vue'), - editorModalProperties: () => import(/* webpackChunkName: "editor-common" */ './editor-modal-properties.vue') + editorModalAccess: () => import(/* webpackChunkName: "editor" */ './editor-modal-access.vue'), + editorModalProperties: () => import(/* webpackChunkName: "editor" */ './editor-modal-properties.vue') }, data() { return { diff --git a/client/scss/base/base.scss b/client/scss/base/base.scss index ad834d1d..3e070e28 100644 --- a/client/scss/base/base.scss +++ b/client/scss/base/base.scss @@ -20,28 +20,17 @@ html { } } -body { - background-color: lighten(mc('blue-grey','50'), 5%); - height: 100%; -} - -main { - background-color: mc('blue','500'); - background-image: linear-gradient(to bottom, mc('blue', '700') 0%, mc('blue', '500') 100%); - padding: 50px; - min-height: 100vh; -} - -a { - color: mc('indigo', '600'); - text-decoration: none; - - &:hover { - color: mc('indigo', '700'); - text-decoration: underline; - } -} +// body { +// background-color: lighten(mc('blue-grey','50'), 5%); +// height: 100%; +// } +// main { +// background-color: mc('blue','500'); +// background-image: linear-gradient(to bottom, mc('blue', '700') 0%, mc('blue', '500') 100%); +// padding: 50px; +// min-height: 100vh; +// } // Container .container { diff --git a/package.json b/package.json index 01951816..27f1d837 100644 --- a/package.json +++ b/package.json @@ -201,6 +201,7 @@ "vue-codemirror": "4.0.3", "vue-hot-reload-api": "2.2.4", "vue-loader": "14.1.1", + "vue-router": "3.0.1", "vue-simple-breakpoints": "1.0.3", "vue-template-compiler": "2.5.13", "vuetify": "1.0.1", diff --git a/server/controllers/common.js b/server/controllers/common.js index 47c2965b..5c5df71c 100644 --- a/server/controllers/common.js +++ b/server/controllers/common.js @@ -8,6 +8,13 @@ router.get('/e/*', (req, res, next) => { res.render('main/editor') }) +/** + * Administration + */ +router.get(['/a', '/a/*'], (req, res, next) => { + res.render('main/admin') +}) + /** * View document */ diff --git a/server/views/main/admin.pug b/server/views/main/admin.pug new file mode 100644 index 00000000..2ec208d3 --- /dev/null +++ b/server/views/main/admin.pug @@ -0,0 +1,6 @@ +extends ../master.pug + +block body + body + #app + admin diff --git a/yarn.lock b/yarn.lock index 0e9738f2..f7ae887e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10412,6 +10412,10 @@ vue-loader@14.1.1: vue-style-loader "^4.0.1" vue-template-es2015-compiler "^1.6.0" +vue-router@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.0.1.tgz#d9b05ad9c7420ba0f626d6500d693e60092cc1e9" + vue-simple-breakpoints@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/vue-simple-breakpoints/-/vue-simple-breakpoints-1.0.3.tgz#0ae5b77af4cdbd948b514d2f485686174dc5ff5d"