aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/layout.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes/ui/layout.rs')
-rw-r--r--server/src/routes/ui/layout.rs6
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(),