add power menu template builder and mount route

This commit is contained in:
glyph 2022-11-03 12:02:01 +00:00
parent 8c3a92aa88
commit 7d5d6bcc1f
4 changed files with 30 additions and 0 deletions

View File

@ -49,6 +49,10 @@ pub fn mount_peachpub_routes(
Response::html(routes::guide::build_template())
},
(GET) (/power) => {
Response::html(routes::power::menu::build_template())
},
(POST) (/scuttlebutt/block) => {
routes::scuttlebutt::block::handle_form(request)
},

View File

@ -3,6 +3,7 @@ pub mod authentication;
//pub mod index;
pub mod guide;
pub mod home;
pub mod power;
pub mod scuttlebutt;
pub mod settings;
pub mod status;

View File

@ -0,0 +1,24 @@
use maud::{html, PreEscaped};
use crate::{templates, utils::theme};
pub fn build_template() -> PreEscaped<String> {
let power_menu_template = html! {
(PreEscaped("<!-- POWER MENU -->"))
div class="card center" {
div class="card-container" {
div id="buttons" {
a id="rebootBtn" class="button button-primary center" href="/reboot" title="Reboot Device" { "Reboot" }
a id="shutdownBtn" class="button button-warning center" href="/shutdown" title="Shutdown Device" { "Shutdown" }
a id="cancelBtn" class="button button-secondary center" href="/" title="Cancel" { "Cancel" }
}
}
}
};
let body = templates::nav::build_template(power_menu_template, "Power Menu", Some("/"));
let theme = theme::get_theme();
templates::base::build_template(body, theme)
}

View File

@ -0,0 +1 @@
pub mod menu;