Migrate footer to use Markdown blocks.
Introduce uwsgi reloading for Python changes.
This commit is contained in:
parent
69f73a2abf
commit
02aebf74bf
|
@ -74,7 +74,7 @@ def get_site():
|
||||||
'name': 'Rookeries',
|
'name': 'Rookeries',
|
||||||
'favicon': '/static/images/mr-penguin-amber-favicon.ico',
|
'favicon': '/static/images/mr-penguin-amber-favicon.ico',
|
||||||
'config': {
|
'config': {
|
||||||
'footer': 'Rookeries - © 2013-2016 - Amber Penguin Software',
|
'footer': 'Rookeries - © 2013-2017 - Amber Penguin Software',
|
||||||
'name': 'Rookeries',
|
'name': 'Rookeries',
|
||||||
'tagline': 'Simple Site Construction',
|
'tagline': 'Simple Site Construction',
|
||||||
'logo': '/static/images/mr-penguin-amber.svg',
|
'logo': '/static/images/mr-penguin-amber.svg',
|
||||||
|
|
|
@ -26,7 +26,7 @@ import {PageBlock} from '../views/MarkdownBlock';
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
static get propTypes() {
|
static get propTypes() {
|
||||||
return {
|
return {
|
||||||
siteMenu: PropTypes.object,
|
menu: PropTypes.object,
|
||||||
footer: PropTypes.string,
|
footer: PropTypes.string,
|
||||||
siteName: PropTypes.string,
|
siteName: PropTypes.string,
|
||||||
logo: PropTypes.string,
|
logo: PropTypes.string,
|
||||||
|
@ -58,7 +58,7 @@ class App extends Component {
|
||||||
{/*TODO Extract as Main body and navigation sidebar containers.*/}
|
{/*TODO Extract as Main body and navigation sidebar containers.*/}
|
||||||
<Row className='justify-content-center'>
|
<Row className='justify-content-center'>
|
||||||
<Col lg='3'>s
|
<Col lg='3'>s
|
||||||
<NavigationMenu menu={ this.props.siteMenu } />
|
<NavigationMenu menu={ this.props.menu } />
|
||||||
</Col>
|
</Col>
|
||||||
<Col lg='8' className='ice-floe'>
|
<Col lg='8' className='ice-floe'>
|
||||||
<Switch>
|
<Switch>
|
||||||
|
@ -78,8 +78,11 @@ class App extends Component {
|
||||||
export const RookeriesApp = withRouter(connect(
|
export const RookeriesApp = withRouter(connect(
|
||||||
(state) => {
|
(state) => {
|
||||||
return {
|
return {
|
||||||
'siteMenu': state.menu,
|
'menu': state.menu,
|
||||||
'footer': state.site.footer,
|
'footer': {
|
||||||
|
'slug': '_header',
|
||||||
|
'content': state.site.footer,
|
||||||
|
},
|
||||||
'siteName': state.site.name,
|
'siteName': state.site.name,
|
||||||
'logo': state.site.logo,
|
'logo': state.site.logo,
|
||||||
'tagline': state.site.tagline,
|
'tagline': state.site.tagline,
|
||||||
|
|
|
@ -9,9 +9,10 @@ Site footer
|
||||||
|
|
||||||
import {h, Component} from 'preact'; /** @jsx h*/
|
import {h, Component} from 'preact'; /** @jsx h*/
|
||||||
import {Row, Col, Container} from 'reactstrap';
|
import {Row, Col, Container} from 'reactstrap';
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
import {MarkdownBlock} from '../views/MarkdownBlock';
|
||||||
|
|
||||||
|
|
||||||
export class SiteFooter extends Component {
|
export class SiteFooter extends Component {
|
||||||
static get propTypes() {
|
static get propTypes() {
|
||||||
|
@ -25,7 +26,7 @@ export class SiteFooter extends Component {
|
||||||
<Container>
|
<Container>
|
||||||
<Row className='justify-content-end'>
|
<Row className='justify-content-end'>
|
||||||
<Col lg='8'>
|
<Col lg='8'>
|
||||||
<footer>{ this.props.footer }</footer>
|
<MarkdownBlock { ...this.props.footer } id='footer' />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
|
@ -31,8 +31,32 @@ export const EditorPaneState = {
|
||||||
editableOpen: 2
|
editableOpen: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export class MarkdownBlock extends Component {
|
export class MarkdownBlock extends Component {
|
||||||
|
static get propTypes() {
|
||||||
|
return {
|
||||||
|
id: PropTypes.string,
|
||||||
|
slug: PropTypes.string,
|
||||||
|
content: PropTypes.string,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let md = markdown({
|
||||||
|
html: true,
|
||||||
|
highlight: (code_) => {
|
||||||
|
return highlighter.highlightAuto(code_).value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let rawMarkup = md.render(this.props.content);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span id={ this.props.id } dangerouslySetInnerHTML={{__html: rawMarkup}} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export class EditableMarkdownBlock extends Component {
|
||||||
static get propTypes() {
|
static get propTypes() {
|
||||||
return {
|
return {
|
||||||
slug: PropTypes.string,
|
slug: PropTypes.string,
|
||||||
|
@ -181,5 +205,5 @@ export const PageBlock = withRouter(
|
||||||
'editorTheme': state.editor.theme,
|
'editorTheme': state.editor.theme,
|
||||||
'userCanEdit': state.user.token !== ''
|
'userCanEdit': state.user.token !== ''
|
||||||
};
|
};
|
||||||
})(MarkdownBlock)
|
})(EditableMarkdownBlock)
|
||||||
);
|
);
|
||||||
|
|
|
@ -167,7 +167,7 @@ ul.navigation-bar > li > a {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Footer ***/
|
/*** Footer ***/
|
||||||
footer {
|
#footer {
|
||||||
font-family: var(--console-font-family);
|
font-family: var(--console-font-family);
|
||||||
font-size: small;
|
font-size: small;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
|
@ -45,7 +45,7 @@ body.daytime {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Footer ***/
|
/*** Footer ***/
|
||||||
body.daytime footer {
|
body.daytime #footer {
|
||||||
color: var(--daytime-footer-text-colour);
|
color: var(--daytime-footer-text-colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ body.evening {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Footer ***/
|
/*** Footer ***/
|
||||||
body.evening footer {
|
body.evening #footer {
|
||||||
color: var(--evening-footer-text-colour);
|
color: var(--evening-footer-text-colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ def wait(ctx, timeout=10):
|
||||||
|
|
||||||
|
|
||||||
@inv.task(prepare_assets)
|
@inv.task(prepare_assets)
|
||||||
def run(ctx, port=5000):
|
def run(ctx, port=5000, dev_mode=False):
|
||||||
"""
|
"""
|
||||||
Run the API app in a server
|
Run the API app in a server
|
||||||
By default this runs a production uWSGI server.
|
By default this runs a production uWSGI server.
|
||||||
|
@ -49,11 +49,14 @@ def run(ctx, port=5000):
|
||||||
:param port: The port to run the API app on. 5000 by default.
|
:param port: The port to run the API app on. 5000 by default.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
autoreload_flag = '' if not dev_mode else '--py-autoreload 1'
|
||||||
|
|
||||||
uwsgi_cmd = ' '.join([
|
uwsgi_cmd = ' '.join([
|
||||||
'uwsgi',
|
'uwsgi',
|
||||||
f'--http :{port}',
|
f'--http :{port}',
|
||||||
'--master',
|
'--master',
|
||||||
'--processes 4',
|
'--processes 4',
|
||||||
|
autoreload_flag,
|
||||||
'--module "rookeries:make_rookeries_app()"',
|
'--module "rookeries:make_rookeries_app()"',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import {h} from "preact"; /** @jsx h */
|
import {h} from "preact"; /** @jsx h */
|
||||||
|
|
||||||
import { MarkdownBlock } from "../../src/views/MarkdownBlock";
|
import { EditableMarkdownBlock } from "../../src/views/MarkdownBlock";
|
||||||
|
|
||||||
import chai, {assert, expect} from "chai";
|
import chai, {assert, expect} from "chai";
|
||||||
import assertJsx from "preact-jsx-chai";
|
import assertJsx from "preact-jsx-chai";
|
||||||
|
@ -19,7 +19,7 @@ describe('JournalMarkdownViewer', () => {
|
||||||
|
|
||||||
describe("Fetching of Articles by view linked to store", () => {
|
describe("Fetching of Articles by view linked to store", () => {
|
||||||
it('The view should default to a loading text when initializing and then calling for data', () => {
|
it('The view should default to a loading text when initializing and then calling for data', () => {
|
||||||
expect(<MarkdownBlock />)
|
expect(<EditableMarkdownBlock />)
|
||||||
.to.not.eql(
|
.to.not.eql(
|
||||||
<div>
|
<div>
|
||||||
<h1>Loading...</h1>
|
<h1>Loading...</h1>
|
||||||
|
@ -27,7 +27,7 @@ describe('JournalMarkdownViewer', () => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(<MarkdownBlock />)
|
expect(<EditableMarkdownBlock />)
|
||||||
.to.contain(
|
.to.contain(
|
||||||
<div>
|
<div>
|
||||||
<h1 />
|
<h1 />
|
||||||
|
|
Loading…
Reference in New Issue