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

31 lines
1.3 KiB
Rust
Raw Normal View History

use maud::{html, PreEscaped};
2021-11-15 15:32:00 +00:00
use crate::{templates, CONFIG};
2021-11-15 15:32:00 +00:00
// TODO: flash message implementation for rouille
//
2022-03-11 13:33:04 +00:00
/// Settings menu template builder.
pub fn build() -> PreEscaped<String> {
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
@if !CONFIG.standalone_mode {
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(menu_template, "Settings", Some("/"));
// render the base template with the provided body
templates::base::build(body)
2021-11-15 15:32:00 +00:00
}