1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-16 21:27:30 +00:00
bibliogram/src/site/pug/settings.pug

128 lines
4.0 KiB
Plaintext
Raw Normal View History

2020-05-09 15:20:13 +00:00
//- Needs constants, settings, csrf, status, message
2020-05-04 14:02:35 +00:00
mixin fieldset(name)
fieldset
legend= name
.fieldset-contents
block
2020-05-09 09:34:00 +00:00
mixin input(id, description, placeholder, disabled)
2020-05-04 14:02:35 +00:00
.field-row
label.description(for=id)= description
2020-05-09 09:34:00 +00:00
input(type="text" id=id name=id value=settings[id] placeholder=placeholder disabled=disabled)
2020-05-04 14:02:35 +00:00
2020-05-05 13:45:56 +00:00
mixin checkbox(id, description, label, disabled)
2020-05-04 14:02:35 +00:00
.field-row.checkbox-row
label.description(for=id)= description
2020-05-05 13:45:56 +00:00
input.checkbox(type="checkbox" id=id name=id checked=(settings[id] !== 0) disabled=disabled autocomplete="off")
2020-05-04 14:02:35 +00:00
label.pill(for=id tabindex=(disabled ? null : 0) onkeypress=`[" ", "Enter"].includes(event.key) && this.click()`)= label
span.fake-checkbox
mixin select(id, description, disabled, options)
.field-row
label.description(for=id)= description
select(id=id name=id disabled=disabled)
2020-05-05 13:45:56 +00:00
each option in options
option(value=option.value selected=(option.value === settings[id]))= option.text
2020-05-04 14:02:35 +00:00
doctype html
html
head
title Settings | Bibliogram
include includes/head
body.settings-page
2020-05-09 15:20:13 +00:00
if status && message
.status-notice(class=status)= message
2020-05-04 15:06:07 +00:00
script.
history.replaceState(null, "", "/settings")
2020-05-04 14:02:35 +00:00
main.settings
2020-05-04 15:06:07 +00:00
form(action="/settings" method="post" enctype="application/x-www-form-urlencoded")
2020-05-09 15:20:13 +00:00
input(type="hidden" name="csrf" value=csrf)
2020-05-04 14:02:35 +00:00
h1 Settings
+fieldset("Features")
2020-05-05 13:45:56 +00:00
+select("language", "Language", true, [
{value: "en", text: "English (International)"},
{value: "en-us", text: "English (US)"}
])
2020-05-04 14:02:35 +00:00
2020-05-09 09:34:00 +00:00
+select("save_data", "Save data", true, [
{value: "automatic", text: "Automatic"},
{value: "off", text: "Off"},
{value: "lazy_load", text: "Lazy load"},
{value: "full", text: "Full"}
])
+input("rewrite_youtube", "Rewrite YouTube domain", "youtube.com", true)
+input("rewrite_twitter", "Rewrite Twitter domain", "twitter.com", true)
2020-05-05 13:45:56 +00:00
+checkbox("show_comments", "Display comments", "Display", true)
2020-05-04 14:02:35 +00:00
2020-05-05 13:45:56 +00:00
+checkbox("link_hashtags", "Clickable hashtags", "Clickable", true)
2020-05-04 14:02:35 +00:00
2020-05-05 14:14:11 +00:00
+checkbox("spa", "Fast navigation", "Enabled", false)
2020-05-04 14:02:35 +00:00
+fieldset("Appearance")
2020-05-10 11:58:05 +00:00
+select("theme", "Theme", false, constants.themes.collated.map(entry => ({value: entry.file, text: entry.name})))
2020-05-04 14:02:35 +00:00
2020-05-05 15:35:18 +00:00
+checkbox("display_top_nav", "Display top bar", "Always", false)
+select("timeline_columns", "Timeline columns", true, [
{value: "dynamic", text: "Dynamic"},
{value: "3", text: "3 columns"},
{value: "4", text: "4 columns"},
{value: "6", text: "6 columns"}
])
+select("caption_side", "Caption side", false, [
2020-05-05 13:45:56 +00:00
{value: "left", text: "Left (Bibliogram)"},
{value: "right", text: "Right (Instagram)"}
])
2020-05-04 14:02:35 +00:00
+checkbox("display_alt", "Display alt text inline", "Display", false)
2020-05-04 14:02:35 +00:00
//- div
//- Here are all the possible input styles. Uncomment to test styling.
- let i = 2
- let id = 0
- let thisID
while --i >= 0
fieldset
legend Style demo
.field-row
- thisID = "in"+(id++)
label.description(for=thisID) Placeholder
input(type="text" placeholder="Placeholder" id=thisID)
.field-row
- thisID = "in"+(id++)
label.description(for=thisID) Disabled
input(type="text" disabled placeholder="Disabled" value="Value" id=thisID)
.field-row
label.description Button
button(type="button") Button
.field-row
- thisID = "in"+(id++)
label.description(for=thisID) Select
select(id=thisID)
option Select
option Yes
option No
option Always
option Never
.field-row.checkbox-row
- thisID = "in"+(id++)
label.description(for=thisID) Checkbox
input.checkbox(type="checkbox" id=thisID)
label.pill(for=thisID tabindex=0 onkeypress=`[" ", "Enter"].includes(event.key) && this.click()`) Label
span.fake-checkbox
.action-container
a(href="/").home-link ← Home
button(type="submit").save-button Save settings