Massive overhaul, fixing menus and changing template engine. Added /month/ and /author/ filters

This commit is contained in:
2017-10-29 17:41:40 +01:00
parent b05f53308e
commit fb9e43ba12
44 changed files with 862 additions and 519 deletions
+30
View File
@@ -0,0 +1,30 @@
extends ../base/master
block append css
link[rel="stylesheet"][href="/ui/css/form.css"]
block append js
script[type="text/javascript"][src="/ui/js/form-page.js"]
block menu
import menu
block main
$page = $.Page
article
h1.danger Delete
form[action=$page.OpPath("delete")][method="POST"]
p.danger This is irreversible, so make sure you are deleting the right page.
ul
li <b>ID:</b> #{$.Page.ID}
li <b>Name:</b> #{$.Page.Name}
li <b>Category:</b> #{$.Page.Category}
li <b>Published:</b> #{formatDateLong($.Page.PublishDate)}
ul
input[type="hidden"][name="aft"][value=$.User.SessionID]
button[type="submit"] Delete
+64
View File
@@ -0,0 +1,64 @@
extends ../base/master
block append css
link[rel="stylesheet"][href="/ui/css/form.css"]
block append js
script[type="text/javascript"][src="/ui/js/form-page.js"]
block menu
import menu
block main
$page = $.Page
article
h1 Create
form[action=$page.OpPath("edit")][method="POST"]
p.danger #{$.Error}
input.big
[placeholder="Page Name"]
[value=$page.Name]
[type="text"]
[name="name"]
textarea.tall
[placeholder="Content"]
[name="source"]
| #{$page.Source}
input
[placeholder="IC Date (e.g. 'Oct 27, 2185')"]
[name="fictionalDate"]
[type="text"]
[value=$page.FictionalDate] ? !$page.FictionalDate.IsZero
h2 Category
div.group[title="Category"]
each $category in $.Categories
div.radio-wrapper
$radioid = printf("radio-%s", $category.Key)
if $category.Key == $page.Category
input[id=$radioid][name="category"][type="radio"][name="category"][value=$category.Key][checked]
else
input[id=$radioid][name="category"][type="radio"][name="category"][value=$category.Key]
label[for=$radioid]
b #{$category.Key}:
span #{$category.Info}
h2 Tags
textarea
[name="tags"]
[placeholder="Location: Miner's Respite\nOrganization: Redrock Agency\nCharacter: Renala T'Iavay\nEvent: Skipping Work\nSeries: Just Another Tuesday"]
| #{$.TagInput}
h2 Options
div.group
+formoption("unlisted", $page.Unlisted, "Unlisted", "The page will not show up in any page list. Meant for omni-tool messages, quick copypastes and so on.")
+formoption("indexed", $page.Indexed, "Indexable", "Third-party search engines (that play by the rules) are permitted to crawl this page.")
// Future options (maybe)
input[type="hidden"][name="type"][value="Markdown"]
input[type="hidden"][name="published"][value="True"]
button[type="submit"] Edit
+29
View File
@@ -0,0 +1,29 @@
import ../base/mixins
$pagePath = printf("/page/%s", $.Page.ID)
$pageEditPath = printf("/page/edit/%s", $.Page.ID)
$pageDeletePath = printf("/page/delete/%s", $.Page.ID)
$pageSourcePath = printf("/page/source/%s", $.Page.ID)
$datePath = printf("/month/%s", $.Page.FictionalDate.UTC.Format("2006-01"))
$authorPath = printf("/author/%s", $.Page.Author)
a[href="/"]
h1 Page
if !$.HideMenu
ul
+menuitem($pagePath, "V", "View")
if $.Page.Author == $.User.ID
+menuitem($pageEditPath, "E", "Edit")
+menuitem($pageDeletePath, "X", "Delete")
else
+menuitem($pageSourcePath, "#", "Source")
ul
each $tag in $.Page.Tags
+tagmenuitem($tag)
ul
if $.Page.Dated
+menuitem($datePath, "D", formatDate($.Page.FictionalDate))
+menuitem($authorPath, "A", formatUserID($.Page.Author))
+14
View File
@@ -0,0 +1,14 @@
extends ../base/master
block append meta
if !$.Page.Indexed
meta[name="robots"][content="noindex"]
meta[name="googlebot"][content="noindex"]
block menu
import menu
block main
article
code.block
#{$.Page.Source}
+13
View File
@@ -0,0 +1,13 @@
extends ../base/master
block append meta
if !$.Page.Indexed
meta[name="robots"][content="noindex"]
meta[name="googlebot"][content="noindex"]
block menu
import menu
block main
article.narrow
#{$.Page.Content}