diff options
author | metamuffin <metamuffin@disroot.org> | 2023-06-13 23:26:31 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-06-13 23:26:31 +0200 |
commit | 3fb4e4117df9d668815e974dea6b2a29436c92af (patch) | |
tree | 6cc9e2c434c35b218582ca6c32e262524403eb48 /server/src/routes/ui/layout.rs | |
parent | 876fe4bd1f64ecd131947d327e587c1aa295e32e (diff) | |
download | jellything-3fb4e4117df9d668815e974dea6b2a29436c92af.tar jellything-3fb4e4117df9d668815e974dea6b2a29436c92af.tar.bz2 jellything-3fb4e4117df9d668815e974dea6b2a29436c92af.tar.zst |
some cleanup
Diffstat (limited to 'server/src/routes/ui/layout.rs')
-rw-r--r-- | server/src/routes/ui/layout.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/src/routes/ui/layout.rs b/server/src/routes/ui/layout.rs index ecccc7c..6900dc3 100644 --- a/server/src/routes/ui/layout.rs +++ b/server/src/routes/ui/layout.rs @@ -21,7 +21,7 @@ use rocket::{ use std::io::Cursor; markup::define! { - Layout<'a, Main: Render>(title: String, main: Main, class: Option<&'a str>, session: Option<Session>) { + Layout<'a, Main: Render>(title: String, main: Main, class: Option<&'a str>, session: Option<Session>, show_back: bool) { @markup::doctype() html { head { @@ -31,6 +31,7 @@ markup::define! { } body[class=class.unwrap_or("")] { nav { + @if *show_back { a[onclick="history.back()", href="#"] { "<- Back" } } h1 { a[href="/"] { @CONF.brand } } @if let Some(_) = session { a[href="/library"] { "My Library" } @@ -65,6 +66,7 @@ pub type DynLayoutPage<'a> = LayoutPage<markup::DynRender<'a>>; pub struct LayoutPage<T> { pub title: String, pub class: Option<&'static str>, + pub show_back: bool, pub content: T, } @@ -74,6 +76,7 @@ impl Default for LayoutPage<DynRender<'_>> { class: None, content: markup::new!(), title: String::new(), + show_back: false, } } } @@ -86,6 +89,7 @@ impl<'r, Main: Render> Responder<'r, 'static> for LayoutPage<Main> { let session = block_on(req.guard::<Option<Session>>()).unwrap(); let mut out = String::new(); Layout { + show_back: self.show_back, main: self.content, title: self.title, class: self.class.as_deref(), |