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
+44
View File
@@ -0,0 +1,44 @@
doctype 5
import mixins
html
head
block meta
meta[name="description"][content="This is a great website"]
meta[charset="UTF-8"]
meta[name="viewport"][content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=no"]
meta[name="theme-color"][content="#112233"]
meta[http-equiv="Content-Type"][content="text/html; charset=utf-8"]
block css
link[rel="stylesheet"][href="/ui/css/base.css"]
link[rel="stylesheet"][href="/ui/css/magic.css"]
link[rel="stylesheet"][href="/ui/css/theme.css"]
link[rel="stylesheet"][media="screen"][href="/ui/fonts/source-sans-pro/source-sans-pro.css"][type="text/css"]
block js
script[type="text/javascript"][src="/ui/js/background.js"]
title #{ViewTitle}
body
if ViewBackground != ""
img[id="main-background"][src="/ui/img/bg.png"]
else
img[id="main-background"][src="/ui/img/bg.png"]
div.content-wrapper
nav
block menu
if User.LoggedIn
ul
+menuitem("/user/logout", "U", "Logout")
else
ul
+menuitem("/user/login", "U", "Login")
if ViewPath != "/"
+menuitem("/", "<", "Back")
main
block main
+30
View File
@@ -0,0 +1,30 @@
$root = $
mixin menuitem($path, $icon, $text)
li
.selected ? $root.ViewPath == $path
a[href=$path]
div.mg-icon #{$icon}
div.mg-label #{$text}
mixin tagmenuitem($tag)
li
[class=$tag.CSSClass]
a[href=$tag.Path]
div.mg-icon #{$tag.Icon}
div.mg-label #{$tag.Name}
mixin formoption($name, $selected, $label, $info)
div.radio-wrapper
$id = printf("checkbox-%s", $name)
if $selected
input[id=$id][type="checkbox"][name=$name][value="true"][checked]
else
input[id=$id][type="checkbox"][name=$name][value="true"]
label[for="checkbox-unlisted"]
b #{$label}:
spamn #{$info}
+63
View File
@@ -0,0 +1,63 @@
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/create"][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.Unlisted, "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"] Create
+25
View File
@@ -0,0 +1,25 @@
extends base/master
block menu
import menu
block main
article
table.page-list
tbody
each $header in Headers
tr
td.pl-icon #{$header.CategoryInfo.Icon}
td.pl-content
div.plc-title
a[href=$header.Path] #{$header.Name}
div.plc-meta
div.plcm-date #{formatDate($header.PublishDate)}
if $header.Dated
div.plcm-date #{formatDate($header.FictionalDate)}
if $header.PrimaryTag
div.plcm-tag[class=$header.PrimaryTag.CSSCLass] #{$header.PrimaryTag.Name}
div.plcm-author #{formatUserID($header.Author)}
tr.spacer
td
+25
View File
@@ -0,0 +1,25 @@
import base/mixins
$authorPath = printf("/author/%s", ActiveAuthor)
a[href="/"]
h1 Aite RP
ul
if User.LoggedIn
+menuitem("/page/create", "+", "Create")
ul
each $category in Categories
+menuitem($category.Path, $category.Icon, $category.Plural)
ul
if ActiveTag.ID
+menuitem(ActiveTag.Path, ActiveTag.Icon, ActiveTag.Name)
if ActiveDate
+menuitem(ActiveDatePath, "D", ActiveDate)
if ActiveAuthor
+menuitem($authorPath, "A", formatUserID(ActiveAuthor))
ul
+menuitem("/tags/", "T", "Tags")
+12
View File
@@ -0,0 +1,12 @@
extends base/master
block menu
a[href="/"]
h1 Aite RP
block main
article
h1
.danger ? $.Danger
| #{$.Title}
p #{$.Text}
+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}
+17
View File
@@ -0,0 +1,17 @@
extends base/master
block menu
import menu
block main
article
h1 All Tags
div.tag-list
each $key, $tags in $.Map
if $tags
div.tl-item
h2 #{$key}
ul
each $tag in $tags
li
a[class=$tag.CSSClass][href=$tag.Path] #{$tag.Name}
+26
View File
@@ -0,0 +1,26 @@
extends ../base/master
block append css
link[rel="stylesheet"][href="/ui/css/form.css"]
block menu
import menu
block main
article
h1 Login
form[action="/user/login"][method="POST"]
p Use your wiki.aiterp.net account.
p.danger #{$.Error}
input
[placeholder="Username"]
[name="username"]
[type="text"]
[value=$.UserName]
[autofocus] ? $.UserName == ""
input
[placeholder="Password"]
[name="password"]
[type="password"]
[autofocus] ? $.UserName != ""
button[type="submit"] Login
+4
View File
@@ -0,0 +1,4 @@
import ../base/mixins
a[href="/"]
h1 User