mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-22 08:07:30 +00:00
Make additional themes more easily configurable
This commit is contained in:
parent
9fbbf66e62
commit
8aac24bac8
@ -68,8 +68,20 @@ let constants = {
|
||||
feed_disabled_max_age: 2*24*60*60 // 2 days
|
||||
},
|
||||
|
||||
// Enabled themes. `file` is the filename without extension. `name` is the display name on the settings page.
|
||||
// If you make your own theme, I encourage you to submit a pull request for it!
|
||||
themes: [
|
||||
{file: "classic", name: "Classic"},
|
||||
{file: "blue", name: "Classic blue"}
|
||||
],
|
||||
|
||||
user_settings: [
|
||||
{
|
||||
name: "theme",
|
||||
default: "classic",
|
||||
boolean: false,
|
||||
replaceEmptyWithDefault: true
|
||||
},{
|
||||
name: "language",
|
||||
default: "en",
|
||||
boolean: false,
|
||||
@ -89,11 +101,6 @@ let constants = {
|
||||
default: "on",
|
||||
boolean: true,
|
||||
replaceEmptyWithDefault: false
|
||||
},{
|
||||
name: "theme",
|
||||
default: "classic",
|
||||
boolean: false,
|
||||
replaceEmptyWithDefault: true
|
||||
},{
|
||||
name: "caption_side",
|
||||
default: "left",
|
||||
|
@ -10,7 +10,7 @@ module.exports = [
|
||||
const settings = getSettings(req)
|
||||
// console.log(settings)
|
||||
const saved = url.searchParams.has("saved")
|
||||
return render(200, "pug/settings.pug", {saved, settings})
|
||||
return render(200, "pug/settings.pug", {saved, constants, settings})
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -63,10 +63,7 @@ html
|
||||
+checkbox("spa", "Fast navigation", "Enabled", false)
|
||||
|
||||
+fieldset("Appearance")
|
||||
+select("theme", "Theme", false, [
|
||||
{value: "classic", text: "Classic"},
|
||||
{value: "blue", text: "Classic blue"}
|
||||
])
|
||||
+select("theme", "Theme", false, constants.themes.map(entry => ({value: entry.file, text: entry.name})))
|
||||
|
||||
+checkbox("display_top_nav", "Display top bar", "Always", false)
|
||||
|
||||
|
@ -21,8 +21,9 @@ subdirs("pug", async (err, dirs) => {
|
||||
await require("../lib/utils/upgradedb")()
|
||||
|
||||
pinski.setNotFoundTarget("/404")
|
||||
pinski.addRoute("/static/css/classic.css", "sass/classic.sass", "sass")
|
||||
pinski.addRoute("/static/css/blue.css", "sass/blue.sass", "sass")
|
||||
for (const theme of constants.themes) {
|
||||
pinski.addRoute(`/static/css/${theme.file}.css`, `sass/${theme.file}.sass`, "sass")
|
||||
}
|
||||
pinski.addRoute("/settings", "pug/settings.pug", "pug")
|
||||
pinski.addPugDir("pug", dirs)
|
||||
pinski.addSassDir("sass", ["sass/includes", "sass/themes"])
|
||||
|
Loading…
Reference in New Issue
Block a user