Added "publish" button, Minor ui fixes and fix ie11 bug.

This commit is contained in:
Jonatan Nilsson 2019-10-03 12:55:13 +00:00
parent d2539e0b9e
commit feef1765bf
9 changed files with 87 additions and 34 deletions

View file

@ -52,6 +52,10 @@ article.editarticle {
height: 300px; height: 300px;
position: relative; position: relative;
} }
button.submit {
margin-left: 20px;
}
} }
table { table {

View file

@ -78,7 +78,7 @@ const EditArticle = {
banner: null, banner: null,
files: [], files: [],
is_featured: false, is_featured: false,
published_at: new Date().toISOString(), published_at: new Date(new Date().setFullYear(3000)).toISOString(),
} }
this.editedPath = false this.editedPath = false
this.loadedFroala = Froala.loadedFroala this.loadedFroala = Froala.loadedFroala
@ -102,7 +102,7 @@ const EditArticle = {
m.redraw() m.redraw()
}) })
} else { } else {
EditArticle.parsePublishedAt(vnode, new Date()) EditArticle.parsePublishedAt(vnode, null)
document.title = 'Create Article - Admin NFP Moe' document.title = 'Create Article - Admin NFP Moe'
if (vnode.state.froala) { if (vnode.state.froala) {
vnode.state.froala.html.set(this.article.description) vnode.state.froala.html.set(this.article.description)
@ -256,6 +256,7 @@ const EditArticle = {
}, },
view: function(vnode) { view: function(vnode) {
const showPublish = new Date(this.article.published_at) > new Date()
const parents = this.getFlatTree() const parents = this.getFlatTree()
const staffers = this.getStaffers() const staffers = this.getStaffers()
return ( return (
@ -337,10 +338,15 @@ const EditArticle = {
oninput: this.updateValue.bind(this, 'is_featured'), oninput: this.updateValue.bind(this, 'is_featured'),
}), }),
m('div.loading-spinner', { hidden: this.loadedFroala }), m('div.loading-spinner', { hidden: this.loadedFroala }),
m('div', [
m('input', { m('input', {
type: 'submit', type: 'submit',
value: 'Save', value: 'Save',
}), }),
showPublish
? m('button.submit', { onclick: function() { vnode.state.article.published_at = new Date().toISOString() }}, 'Publish')
: null,
]),
]), ]),
this.article.files.length this.article.files.length
? m('files', [ ? m('files', [

View file

@ -151,20 +151,20 @@ form {
} }
} }
input[type=submit] { input[type=submit],
button.submit {
align-self: center; align-self: center;
padding: 0.5em; padding: 0.5em;
margin: 0.5em 0; margin: 0.5em 0;
min-width: 150px; min-width: 150px;
border: none;
border: 1px solid $secondary-bg; border: 1px solid $secondary-bg;
background: $secondary-light-bg; background: $secondary-light-bg;
color: $secondary-light-fg; color: $secondary-light-fg;
height: 31px;
&:hover {
background: $secondary-dark-bg;
color: $secondary-dark-fg;
} }
button.submit::-moz-focus-inner {
border: 0;
} }
} }
@ -172,6 +172,14 @@ a, button {
outline: none; outline: none;
} }
button::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner {
padding: 0 !important;
border: 0 none !important;
}
@import 'froala'; @import 'froala';
@import 'menu/menu'; @import 'menu/menu';

View file

@ -9,6 +9,7 @@ const Footer = {
view: function() { view: function() {
return [ return [
m('div.footer-filler'),
m('div.sitemap', [ m('div.sitemap', [
m('div', 'Sitemap'), m('div', 'Sitemap'),
m(m.route.Link, { class: 'root', href: '/' }, 'Home'), m(m.route.Link, { class: 'root', href: '/' }, 'Home'),

View file

@ -15,7 +15,7 @@ footer {
align-items: center; align-items: center;
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
padding-right: 20px; padding: 0 20px;
a { a {
text-decoration: none; text-decoration: none;
@ -46,9 +46,15 @@ footer {
} }
} }
.footer-filler {
width: 119px;
flex: 0 0 119px;
}
.footer-logo { .footer-logo {
background: center no-repeat transparent; background: center no-repeat transparent;
background-size: contain; background-size: contain;
align-self: center;
width: 119px; width: 119px;
height: 150px; height: 150px;
flex: 0 0 119px; flex: 0 0 119px;
@ -113,6 +119,12 @@ only screen and ( min-resolution: 2dppx) {
} }
} }
@media screen and (max-width: 900px){
footer .footer-filler {
display: none;
}
}
@media screen and (max-width: 480px){ @media screen and (max-width: 480px){
footer { footer {
flex-direction: column; flex-direction: column;
@ -123,7 +135,7 @@ only screen and ( min-resolution: 2dppx) {
} }
.sitemap { .sitemap {
padding-right: 0px; padding: 0px;
ul { ul {
align-self: stretch; align-self: stretch;

View file

@ -112,6 +112,7 @@ const Frontpage = {
m('aside.sidebar', [ m('aside.sidebar', [
m('div.categories', [ m('div.categories', [
m('h4', 'Categories'), m('h4', 'Categories'),
m('div',
Page.Tree.map(function(page) { Page.Tree.map(function(page) {
return [ return [
m(m.route.Link, { class: 'root', href: '/page/' + page.path }, page.name), m(m.route.Link, { class: 'root', href: '/page/' + page.path }, page.name),
@ -121,7 +122,8 @@ const Frontpage = {
})) }))
: null), : null),
] ]
}), })
),
]), ]),
m('div.asunaside'), m('div.asunaside'),
]), ]),

View file

@ -111,9 +111,8 @@ frontpage {
@media screen and (max-width: 900px){ @media screen and (max-width: 900px){
frontpage { frontpage {
flex-direction: column; flex-direction: column;
}
frontpage aside.sidebar { aside.sidebar {
width: auto; width: auto;
flex: 0 0 auto; flex: 0 0 auto;
align-self: stretch; align-self: stretch;
@ -121,11 +120,22 @@ frontpage {
border-bottom: 1px solid $border; border-bottom: 1px solid $border;
order: 2; order: 2;
.categories {
display: flex;
flex-direction: column;
align-items: center;
h4 {
align-self: stretch;
}
}
a { a {
max-width: unset; max-width: unset;
} }
} }
} }
}
.daymode frontpage .asunaside { .daymode frontpage .asunaside {
background-image: url("/assets/img/asuna_frontpage.jpg"); background-image: url("/assets/img/asuna_frontpage.jpg");

View file

@ -1,3 +1,5 @@
require('./polyfill')
const m = require('mithril') const m = require('mithril')
window.m = m window.m = m

8
app/polyfill.js Normal file
View file

@ -0,0 +1,8 @@
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(search, this_len) {
if (this_len === undefined || this_len > this.length) {
this_len = this.length;
}
return this.substring(this_len - search.length, this_len) === search;
};
}