add help page and page titles

- add page titles
- add help page
- update header
This commit is contained in:
Hugh Rundle 2023-01-11 14:04:31 +11:00
parent 153b93d1cd
commit f381c8ea03
4 changed files with 38 additions and 7 deletions

View file

@ -49,8 +49,10 @@ app.set('view engine', 'spy');
app.get('/', requireLoggedIn, (req, res) => { app.get('/', requireLoggedIn, (req, res) => {
let data = { let data = {
title: 'Home',
disabled: '', disabled: '',
message: getSavedFile(req.session.user.username)} message: getSavedFile(req.session.user.username)
}
let today = getNow().toISOString().slice(0,10) let today = getNow().toISOString().slice(0,10)
let latestPost = req.session.user.latest_post let latestPost = req.session.user.latest_post
if (today === latestPost) { if (today === latestPost) {
@ -64,22 +66,26 @@ app.get('/login', (req, res) => {
if (req.session.user) { if (req.session.user) {
res.redirect('/') res.redirect('/')
} else { } else {
res.render('login.spy') res.render('login.spy', {title: 'Log In'})
} }
}) })
app.get('/edit', requireLoggedIn, (req, res) => { app.get('/edit', requireLoggedIn, (req, res) => {
getLatestPost( req.session.user.directory, (data, path) => { getLatestPost( req.session.user.directory, (data, path) => {
res.render('edit.spy', {data: data, path: path}) res.render('edit.spy', {data: data, path: path, title: 'Edit'})
}) })
}) })
app.get('/settings', requireLoggedIn, (req, res) => { app.get('/settings', requireLoggedIn, (req, res) => {
res.render('settings.spy') res.render('settings.spy', {title: 'Settings'})
}) })
app.get('/try-again', requireLoggedIn, (req, res, next) => { app.get('/try-again', requireLoggedIn, (req, res, next) => {
res.render('try-again.spy') res.render('try-again.spy', {title: 'Log In'})
})
app.get('/help', requireLoggedIn, (req, res, next) => {
res.render('help.spy', {title: 'Help'})
}) })
// POST // POST

24
templates/help.spy Normal file
View file

@ -0,0 +1,24 @@
<< partials/head >>
<body>
<< partials/header >>
<main id="settings">
<h1>Help</h1>
<p>Soyuz is a web app for writing Gemini posts.</p>
<section class="help">
<p class="menu-help">New</p>
<p>Takes you to the home page where you can start writing today's post. The title of your post should be indicated by a level 1 heading at the top of the page.</p>
<p class="menu-help">Edit</p>
<p>Edit the most recent post - this could have been published with soyuz, or another way. If you change the title, this will be changed in the year archive and capsule homepage.</p>
<p class="menu-help">Settings</p>
<p>Change your password, or log out.</p>
<p class="menu-help">Help</p>
<p>Display this help page.</p>
<p class="menu-help">Save</p>
<p>Save a draft of your post. Any drafts will be deleted on the next publish.</p>
<p class="menu-help">Publish</p>
<p>Publish the current draft to your Gemini capsule, and delete any saved drafts. You can only publish one post per day, but if you like you can update your day's post by using the 'edit' function.</p>
</section>
</main>
<footer></footer>
</body>
</html>

View file

@ -5,5 +5,5 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/style.css"> <link rel="stylesheet" type="text/css" href="/style.css">
<title>Soyuz</title> <title>Soyuz - {{ title }}</title>
</head> </head>

View file

@ -1,5 +1,6 @@
<header> <header>
<a class="action-button" href="/">New</a> | <a class="action-button" href="/">New</a> |
<a class="action-button" href="/edit">Edit</a> | <a class="action-button" href="/edit">Edit</a> |
<a class="action-button" href="/settings">Settings</a> <a class="action-button" href="/settings">Settings</a> |
<a class="action-button" href="/help">Help</a>
</header> </header>