Added "publish" button, Minor ui fixes and fix ie11 bug.
This commit is contained in:
parent
d2539e0b9e
commit
feef1765bf
9 changed files with 87 additions and 34 deletions
|
@ -52,6 +52,10 @@ article.editarticle {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.submit {
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
|
|
@ -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('input', {
|
m('div', [
|
||||||
type: 'submit',
|
m('input', {
|
||||||
value: 'Save',
|
type: 'submit',
|
||||||
}),
|
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', [
|
||||||
|
|
20
app/app.scss
20
app/app.scss
|
@ -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 {
|
button.submit::-moz-focus-inner {
|
||||||
background: $secondary-dark-bg;
|
border: 0;
|
||||||
color: $secondary-dark-fg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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';
|
||||||
|
|
|
@ -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'),
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -112,16 +112,18 @@ const Frontpage = {
|
||||||
m('aside.sidebar', [
|
m('aside.sidebar', [
|
||||||
m('div.categories', [
|
m('div.categories', [
|
||||||
m('h4', 'Categories'),
|
m('h4', 'Categories'),
|
||||||
Page.Tree.map(function(page) {
|
m('div',
|
||||||
return [
|
Page.Tree.map(function(page) {
|
||||||
m(m.route.Link, { class: 'root', href: '/page/' + page.path }, page.name),
|
return [
|
||||||
(page.children.length
|
m(m.route.Link, { class: 'root', href: '/page/' + page.path }, page.name),
|
||||||
? m('ul', page.children.map(function(subpage) {
|
(page.children.length
|
||||||
return m('li', m(m.route.Link, { class: 'child', href: '/page/' + subpage.path }, subpage.name))
|
? m('ul', page.children.map(function(subpage) {
|
||||||
}))
|
return m('li', m(m.route.Link, { class: 'child', href: '/page/' + subpage.path }, subpage.name))
|
||||||
: null),
|
}))
|
||||||
]
|
: null),
|
||||||
}),
|
]
|
||||||
|
})
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
m('div.asunaside'),
|
m('div.asunaside'),
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -111,18 +111,28 @@ 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;
|
||||||
margin: 20px 0 30px;
|
margin: 20px 0 30px;
|
||||||
border-bottom: 1px solid $border;
|
border-bottom: 1px solid $border;
|
||||||
order: 2;
|
order: 2;
|
||||||
|
|
||||||
a {
|
.categories {
|
||||||
max-width: unset;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
align-self: stretch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
max-width: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
8
app/polyfill.js
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue