From 1df15b58a208f5beb8abd2750096847bd0ce5535 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Sat, 17 Nov 2018 20:45:04 +0100 Subject: [PATCH] updated styling and MOAR TEMPLATING --- assets/css/pretendo-common.css | 9 ++++---- assets/css/pretendo-home.css | 2 +- assets/css/pretendo-news.css | 16 ++++++++++++++ routes/admin.js | 6 +++--- setupAdminUser.js | 12 ++++++++++- views/admin.hbs | 8 +++---- views/partials/footer.hbs | 3 --- views/partials/head.hbs | 14 ------------- views/partials/navbar.hbs | 1 - views/post-collection.hbs | 36 +++++++++++++++++++++++++------- views/post.hbs | 38 ++++++++++++++++++++-------------- 11 files changed, 91 insertions(+), 54 deletions(-) create mode 100644 assets/css/pretendo-news.css delete mode 100644 views/partials/footer.hbs delete mode 100644 views/partials/head.hbs delete mode 100644 views/partials/navbar.hbs diff --git a/assets/css/pretendo-common.css b/assets/css/pretendo-common.css index f90d053..ab2165f 100644 --- a/assets/css/pretendo-common.css +++ b/assets/css/pretendo-common.css @@ -189,7 +189,7 @@ section.bigCardWrapper .bigCard.bigCardPartWrapper { } /* components - buttons */ -button { +button, .btn, .btn-alt { margin: 0; padding: 0; border: 0; @@ -198,14 +198,14 @@ button { font-size: 1em; cursor: pointer; } -button.btn { +.btn, button { background: #673db6; color: white; padding: 12px 80px; border-radius: 10px; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.17); } -button.btn-alt { +.btn-alt { background: white; padding: 10px 45px; color: #673db6; @@ -213,8 +213,9 @@ button.btn-alt { box-shadow: 0 3px 12px rgba(0, 0, 0, 0.07); border-radius: 5px; } -button.btn:hover, button.btn-alt:hover { +.btn:hover, button:hover, .btn-alt:hover { background: #553099; + color: white; } /* components - inputs */ diff --git a/assets/css/pretendo-home.css b/assets/css/pretendo-home.css index e6bca23..ba16187 100644 --- a/assets/css/pretendo-home.css +++ b/assets/css/pretendo-home.css @@ -72,7 +72,7 @@ header h3 { margin-left: 3em; } .smallCard h3 { - font-size: 1.5em !important; + font-size: 1.5em; margin: 0; } diff --git a/assets/css/pretendo-news.css b/assets/css/pretendo-news.css new file mode 100644 index 0000000..15ea167 --- /dev/null +++ b/assets/css/pretendo-news.css @@ -0,0 +1,16 @@ +/* news cards */ +.smallCard { + padding: 20px; + border: 1px solid rgb(165, 165, 165); + border-radius: 10px; + box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07); + position: relative; + margin: .5em; + width: calc(50% - 1em ); + box-sizing: border-box; + display: inline-block; +} +.smallCard h3 { + font-size: 1.5em; + margin: 0; +} \ No newline at end of file diff --git a/routes/admin.js b/routes/admin.js index 5332ca9..0db4da8 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -81,10 +81,10 @@ router.post('/admin/api/v1/register', adminUserMiddleware.adminAuthNeeded, (req, }); // saving to database - newUser.save().then(() => { + newUser.save().then((user) => { apiHelper.sendReturn(res, { - username: req.user.username, - role: req.user.role ? req.user.role : undefined + username: user.username, + role: user.role ? user.role : undefined }); return; }).catch((rejection) => { diff --git a/setupAdminUser.js b/setupAdminUser.js index 3b4fe24..6a8066c 100644 --- a/setupAdminUser.js +++ b/setupAdminUser.js @@ -1,8 +1,18 @@ +const mongoose = require('mongoose'); +// fix database deprecation warnings +mongoose.set('useCreateIndex', true); +mongoose.set('useNewUrlParser', true); +// setup database connection +mongoose.connect(require('./config.json').database.url); +const connection = mongoose.connection; +connection.on('error', console.error.bind(console, 'connection error:')); + const adminUser = require('./models/admin-user'); + const newUser = new adminUser.adminUserModel({ username: 'admin', - password: 'root' + password: 'rootroot' }); newUser.save().then(() => { diff --git a/views/admin.hbs b/views/admin.hbs index c328c18..ea8fa7f 100644 --- a/views/admin.hbs +++ b/views/admin.hbs @@ -1,10 +1,10 @@ - {{> head }} + {{> head-common }} - {{> navbar }} - + {{> nav-default }} +

Admin panel here

register

@@ -122,6 +122,6 @@
Logout - {{> footer }} + {{> footer-default }} diff --git a/views/partials/footer.hbs b/views/partials/footer.hbs deleted file mode 100644 index f8b5f0e..0000000 --- a/views/partials/footer.hbs +++ /dev/null @@ -1,3 +0,0 @@ -
-

© 2018 Pretendo

-
diff --git a/views/partials/head.hbs b/views/partials/head.hbs deleted file mode 100644 index 10f9d38..0000000 --- a/views/partials/head.hbs +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/views/partials/navbar.hbs b/views/partials/navbar.hbs deleted file mode 100644 index 8b13789..0000000 --- a/views/partials/navbar.hbs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/views/post-collection.hbs b/views/post-collection.hbs index ca42724..411a663 100644 --- a/views/post-collection.hbs +++ b/views/post-collection.hbs @@ -1,7 +1,29 @@ -

Latest posts

-{{#each posts }} -{{ this.title }} -

{{ this.content }}

-link -

-{{/each}} \ No newline at end of file + + + + {{> head-common }} + + + + + {{> nav-default }} +
+
+
+
+

Litteral fuck ton

+

All updates

+

{{ this.title }}

+

{{ this.content }}

+ Read more +
+
+
+ + {{> footer-default }} + + \ No newline at end of file diff --git a/views/post.hbs b/views/post.hbs index e20f425..48d511a 100644 --- a/views/post.hbs +++ b/views/post.hbs @@ -1,22 +1,28 @@ - {{> head }} - - {{> navbar }} - -

{{ post.title }}

-

{{ post.date }}

-

{{ post.category }}

- -
- {{{ post.content }}} -
- -

{{ post.author.name }} - {{ post.author.description }}

- - - {{> footer }} + {{> head-common }} + + + + {{> nav-default }} +
+
+
+
+

{{ post.category }} — {{ post.date }}

+

{{ post.title }}

+ {{{ post.content }}} +
+ +
+

{{ post.author.name }}

+

{{ post.author.description }}

+
+
+
+
+ {{> footer-default }}