peach-workspace/peach-web/src/routes/settings/menu.rs

36 lines
1.5 KiB
Rust
Raw Normal View History

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
// ROUTE: /settings
2022-03-11 13:33:04 +00:00
/// Settings menu template builder.
pub fn build_template() -> PreEscaped<String> {
let menu_template = html! {
(PreEscaped("<!-- SETTINGS MENU -->"))
div class="card center" {
(PreEscaped("<!-- BUTTONS -->"))
div id="settingsButtons" {
// render the network settings and power menu buttons if we're
// not in standalone mode
2022-05-12 10:21:05 +00:00
@if !SERVER_CONFIG.standalone_mode {
a id="power" class="button button-primary center" href="/settings/power" title="Power Menu" { "Power" }
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
// wrap the nav bars around the settings menu template content
// parameters are template, title and back url
let body = templates::nav::build_template(menu_template, "Settings", Some("/"));
// query the current theme so we can pass it into the base template builder
let theme = theme::get_theme();
// render the base template with the provided body
templates::base::build_template(body, theme)
2021-11-15 15:32:00 +00:00
}