2022-03-11 12:28:31 +00:00
|
|
|
use maud::{html, PreEscaped};
|
2021-11-15 15:32:00 +00:00
|
|
|
|
2022-05-12 10:21:05 +00:00
|
|
|
use crate::{templates, utils::theme, SERVER_CONFIG};
|
2021-11-15 15:32:00 +00:00
|
|
|
|
2022-03-20 14:38:32 +00:00
|
|
|
// ROUTE: /settings
|
|
|
|
|
2022-03-11 13:33:04 +00:00
|
|
|
/// Settings menu template builder.
|
2022-03-17 09:01:36 +00:00
|
|
|
pub fn build_template() -> PreEscaped<String> {
|
2022-03-11 12:28:31 +00:00
|
|
|
let menu_template = html! {
|
|
|
|
(PreEscaped("<!-- SETTINGS MENU -->"))
|
|
|
|
div class="card center" {
|
|
|
|
(PreEscaped("<!-- BUTTONS -->"))
|
|
|
|
div id="settingsButtons" {
|
|
|
|
// render the network settings button if we're not in standalone mode
|
2022-05-12 10:21:05 +00:00
|
|
|
@if !SERVER_CONFIG.standalone_mode {
|
2022-03-11 12:28:31 +00:00
|
|
|
a id="network" class="button button-primary center" href="/settings/network" title="Network Settings" { "Network" }
|
|
|
|
}
|
|
|
|
a id="scuttlebutt" class="button button-primary center" href="/settings/scuttlebutt" title="Scuttlebutt Settings" { "Scuttlebutt" }
|
|
|
|
a id="admin" class="button button-primary center" href="/settings/admin" title="Administrator Settings" { "Administration" }
|
|
|
|
}
|
|
|
|
}
|
2021-11-15 15:32:00 +00:00
|
|
|
};
|
2022-01-13 11:16:38 +00:00
|
|
|
|
2022-03-11 12:28:31 +00:00
|
|
|
// wrap the nav bars around the settings menu template content
|
|
|
|
// parameters are template, title and back url
|
2022-03-17 09:01:36 +00:00
|
|
|
let body = templates::nav::build_template(menu_template, "Settings", Some("/"));
|
2022-03-11 12:28:31 +00:00
|
|
|
|
2022-03-23 09:41:21 +00:00
|
|
|
// query the current theme so we can pass it into the base template builder
|
|
|
|
let theme = theme::get_theme();
|
|
|
|
|
2022-03-11 12:28:31 +00:00
|
|
|
// render the base template with the provided body
|
2022-03-23 09:41:21 +00:00
|
|
|
templates::base::build_template(body, theme)
|
2021-11-15 15:32:00 +00:00
|
|
|
}
|