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

117 lines
3.4 KiB
Plaintext
Raw Normal View History

2020-05-05 13:45:56 +00:00
//- Needs saved, settings
2020-05-04 14:02:35 +00:00
mixin fieldset(name)
fieldset
legend= name
.fieldset-contents
block
2020-05-05 13:45:56 +00:00
mixin input(id, description, disabled)
2020-05-04 14:02:35 +00:00
.field-row
label.description(for=id)= description
2020-05-05 13:45:56 +00:00
input(type="text" id=id name=id value=settings[id] 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-04 15:06:07 +00:00
if saved
.status-notice Saved.
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-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-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-05 13:45:56 +00:00
+select("theme", "Theme", true, [
{value: "classic", text: "Classic"}
])
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"}
])
2020-05-05 13:45:56 +00:00
+select("caption_side", "Caption side", true, [
{value: "left", text: "Left (Bibliogram)"},
{value: "right", text: "Right (Instagram)"}
])
2020-05-04 14:02:35 +00:00
2020-05-05 13:45:56 +00:00
+checkbox("display_alt", "Display alt text inline", "Display", true)
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