Final tweaks hopefully, added back button to every page

This commit is contained in:
Jonatan Nilsson 2019-10-02 19:25:57 +00:00
parent 074ef0fbdb
commit 4c29079217
8 changed files with 51 additions and 11 deletions

View file

@ -22,7 +22,7 @@
"require-await": 0, "require-await": 0,
"array-callback-return": 2, "array-callback-return": 2,
"block-scoped-var": 2, "block-scoped-var": 2,
"complexity": ["error", 30], "complexity": ["error", 40],
"eqeqeq": [2, "smart"], "eqeqeq": [2, "smart"],
"no-else-return": ["error", { "allowElseIf": false }], "no-else-return": ["error", { "allowElseIf": false }],
"no-extra-bind": 2, "no-extra-bind": 2,

View file

@ -37,7 +37,7 @@ export function serve(docRoot, pathname, options = {}) {
if (filepath.indexOf('admin') >= 0 if (filepath.indexOf('admin') >= 0
&& (filepath.indexOf('js') >= 0 && (filepath.indexOf('js') >= 0
|| filepath.indexOf('css') >= 0)) { || filepath.indexOf('css') >= 0)) {
if (filepath.indexOf('.map') === -1) { if (filepath.indexOf('.map') === -1 && filepath.indexOf('.scss') === -1) {
await restrictAdmin(ctx) await restrictAdmin(ctx)
ctx.set('Cache-Control', 'no-store, no-cache, must-revalidate') ctx.set('Cache-Control', 'no-store, no-cache, must-revalidate')
} else if (config.get('NODE_ENV') !== 'development') { } else if (config.get('NODE_ENV') !== 'development') {

View file

@ -70,6 +70,11 @@ function mapPage(x) {
medium_url: x.media.medium_url, medium_url: x.media.medium_url,
small_url: x.media.small_url, small_url: x.media.small_url,
}) || null, }) || null,
parent: x.parent && ({
id: x.parent.id,
name: x.parent.name,
path: x.parent.path,
}),
banner: x.banner && ({ banner: x.banner && ({
large_url: x.banner.large_url, large_url: x.banner.large_url,
medium_url: x.banner.medium_url, medium_url: x.banner.medium_url,
@ -130,7 +135,7 @@ export async function serveIndex(ctx, path) {
} }
data = found data = found
} else { } else {
found = await Page.getSingle(id, ['media', 'banner', 'children']) found = await Page.getSingle(id, ['media', 'banner', 'children', 'parent'])
found = mapPage(found.toJSON()) found = mapPage(found.toJSON())
data = found data = found
} }

View file

@ -14,6 +14,6 @@ exports.getTree = function() {
exports.getPage = function(id) { exports.getPage = function(id) {
return common.sendRequest({ return common.sendRequest({
method: 'GET', method: 'GET',
url: '/api/pages/' + id + '?includes=media,banner,children', url: '/api/pages/' + id + '?includes=media,banner,children,parent',
}) })
} }

View file

@ -78,7 +78,7 @@ article.article {
width: calc(100% - 40px); width: calc(100% - 40px);
max-width: 800px; max-width: 800px;
align-self: center; align-self: center;
padding: 10px 5px 0; padding: 30px 5px 0;
margin-bottom: -10px; margin-bottom: -10px;
a { a {

View file

@ -64,6 +64,8 @@ frontpage {
a { a {
display: inline-block; display: inline-block;
padding: 0;
max-width: 206px;
} }
} }
} }
@ -101,6 +103,10 @@ frontpage {
frontpage aside.sidebar { frontpage aside.sidebar {
width: 200px; width: 200px;
flex: 0 0 200px; flex: 0 0 200px;
ul li a {
max-width: 156px;
}
} }
} }
@ -116,6 +122,10 @@ frontpage {
margin: 20px 0 30px; margin: 20px 0 30px;
border-bottom: 1px solid $border; border-bottom: 1px solid $border;
order: 2; order: 2;
ul li a {
max-width: unset;
}
} }
} }

View file

@ -112,6 +112,9 @@ const Page = {
m('div.loading-spinner') m('div.loading-spinner')
: m('article.page', [ : m('article.page', [
bannerPath ? m('.div.page-banner', { style: { 'background-image': 'url("' + bannerPath + '")' } } ) : null, bannerPath ? m('.div.page-banner', { style: { 'background-image': 'url("' + bannerPath + '")' } } ) : null,
this.page.parent
? m('div.goback', ['« ', m(m.route.Link, { href: '/page/' + this.page.parent.path }, this.page.parent.name)])
: m('div.goback', ['« ', m(m.route.Link, { href: '/' }, 'Home')]),
m('header', m('h1', this.page.name)), m('header', m('h1', this.page.name)),
m('.container', { m('.container', {
class: this.page.children.length ? 'multi' : '', class: this.page.children.length ? 'multi' : '',

View file

@ -27,7 +27,7 @@ article.page {
} }
.page-cover { .page-cover {
margin: 0 -10px 20px; margin: 0 0 20px;
&.single { &.single {
margin: 0 20px 20px; margin: 0 20px 20px;
@ -38,6 +38,20 @@ article.page {
} }
} }
.goback {
width: 100%;
max-width: 1050px;
align-self: center;
padding: 10px 5px 0;
margin-bottom: -10px;
a {
font-weight: bold;
text-decoration: none;
color: $secondary-dark-bg;
}
}
.admin-actions { .admin-actions {
margin-bottom: 20px; margin-bottom: 20px;
} }
@ -71,18 +85,18 @@ article.page {
align-items: center; align-items: center;
height: auto; height: auto;
padding: 20px 0; padding: 20px 0;
width: 100%;
max-width: 1050px;
align-self: center;
background: $newsitem-bg; background: $newsitem-bg;
border-right: $newsitem-border; border-right: $newsitem-border;
border-left: $newsitem-border; border-left: $newsitem-border;
&.multi { &.multi {
align-self: center;
align-items: flex-start; align-items: flex-start;
flex-direction: row; flex-direction: row;
flex-grow: 2; flex-grow: 2;
width: 100%;
max-width: 1050px;
} }
} }
@ -114,6 +128,10 @@ article.page {
max-width: 800px; max-width: 800px;
flex: 2 0 0; flex: 2 0 0;
.page-cover {
margin: 0 -10px 20px;
}
main { main {
padding: 0 5px; padding: 0 5px;
} }
@ -138,7 +156,7 @@ aside.news {
} }
&.single { &.single {
max-width: 800px; // max-width: 800px;
flex: 2 0 0; flex: 2 0 0;
padding: 0 20px 10px; padding: 0 20px 10px;
border-top: none; border-top: none;
@ -235,4 +253,8 @@ aside.news {
border-bottom: 1px solid $dark_border; border-bottom: 1px solid $dark_border;
} }
} }
.goback a {
color: $dark_secondary-dark-bg;
}
} }