23 lines
795 B
Rust
23 lines
795 B
Rust
use rocket::{get, request::FlashMessage};
|
|
use rocket_dyn_templates::{tera::Context, Template};
|
|
|
|
use crate::routes::authentication::Authenticated;
|
|
|
|
// HELPERS AND ROUTES FOR /settings
|
|
|
|
/// View and delete currently configured admin.
|
|
#[get("/settings")]
|
|
pub fn settings_menu(flash: Option<FlashMessage>, _auth: Authenticated) -> Template {
|
|
let mut context = Context::new();
|
|
context.insert("back", &Some("/".to_string()));
|
|
context.insert("title", &Some("Settings".to_string()));
|
|
|
|
// check to see if there is a flash message to display
|
|
if let Some(flash) = flash {
|
|
context.insert("flash_name", &Some(flash.kind().to_string()));
|
|
context.insert("flash_msg", &Some(flash.message().to_string()));
|
|
};
|
|
|
|
Template::render("settings/menu", &context.into_json())
|
|
}
|