add power menu template builder and mount route
This commit is contained in:
parent
8c3a92aa88
commit
7d5d6bcc1f
@ -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)
|
||||
},
|
||||
|
@ -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;
|
||||
|
24
peach-web/src/routes/power/menu.rs
Normal file
24
peach-web/src/routes/power/menu.rs
Normal 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)
|
||||
}
|
1
peach-web/src/routes/power/mod.rs
Normal file
1
peach-web/src/routes/power/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod menu;
|
Loading…
x
Reference in New Issue
Block a user