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
|
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: [
|
user_settings: [
|
||||||
{
|
{
|
||||||
|
name: "theme",
|
||||||
|
default: "classic",
|
||||||
|
boolean: false,
|
||||||
|
replaceEmptyWithDefault: true
|
||||||
|
},{
|
||||||
name: "language",
|
name: "language",
|
||||||
default: "en",
|
default: "en",
|
||||||
boolean: false,
|
boolean: false,
|
||||||
@ -89,11 +101,6 @@ let constants = {
|
|||||||
default: "on",
|
default: "on",
|
||||||
boolean: true,
|
boolean: true,
|
||||||
replaceEmptyWithDefault: false
|
replaceEmptyWithDefault: false
|
||||||
},{
|
|
||||||
name: "theme",
|
|
||||||
default: "classic",
|
|
||||||
boolean: false,
|
|
||||||
replaceEmptyWithDefault: true
|
|
||||||
},{
|
},{
|
||||||
name: "caption_side",
|
name: "caption_side",
|
||||||
default: "left",
|
default: "left",
|
||||||
|
@ -10,7 +10,7 @@ module.exports = [
|
|||||||
const settings = getSettings(req)
|
const settings = getSettings(req)
|
||||||
// console.log(settings)
|
// console.log(settings)
|
||||||
const saved = url.searchParams.has("saved")
|
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)
|
+checkbox("spa", "Fast navigation", "Enabled", false)
|
||||||
|
|
||||||
+fieldset("Appearance")
|
+fieldset("Appearance")
|
||||||
+select("theme", "Theme", false, [
|
+select("theme", "Theme", false, constants.themes.map(entry => ({value: entry.file, text: entry.name})))
|
||||||
{value: "classic", text: "Classic"},
|
|
||||||
{value: "blue", text: "Classic blue"}
|
|
||||||
])
|
|
||||||
|
|
||||||
+checkbox("display_top_nav", "Display top bar", "Always", false)
|
+checkbox("display_top_nav", "Display top bar", "Always", false)
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ subdirs("pug", async (err, dirs) => {
|
|||||||
await require("../lib/utils/upgradedb")()
|
await require("../lib/utils/upgradedb")()
|
||||||
|
|
||||||
pinski.setNotFoundTarget("/404")
|
pinski.setNotFoundTarget("/404")
|
||||||
pinski.addRoute("/static/css/classic.css", "sass/classic.sass", "sass")
|
for (const theme of constants.themes) {
|
||||||
pinski.addRoute("/static/css/blue.css", "sass/blue.sass", "sass")
|
pinski.addRoute(`/static/css/${theme.file}.css`, `sass/${theme.file}.sass`, "sass")
|
||||||
|
}
|
||||||
pinski.addRoute("/settings", "pug/settings.pug", "pug")
|
pinski.addRoute("/settings", "pug/settings.pug", "pug")
|
||||||
pinski.addPugDir("pug", dirs)
|
pinski.addPugDir("pug", dirs)
|
||||||
pinski.addSassDir("sass", ["sass/includes", "sass/themes"])
|
pinski.addSassDir("sass", ["sass/includes", "sass/themes"])
|
||||||
|
Loading…
Reference in New Issue
Block a user