aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/routes/ui/layout.rs6
-rw-r--r--server/src/routes/ui/node.rs1
-rw-r--r--server/src/routes/ui/player.rs1
-rw-r--r--web/script/backbutton.ts8
-rw-r--r--web/script/main.ts1
5 files changed, 10 insertions, 7 deletions
diff --git a/server/src/routes/ui/layout.rs b/server/src/routes/ui/layout.rs
index 1c47247..cdac09c 100644
--- a/server/src/routes/ui/layout.rs
+++ b/server/src/routes/ui/layout.rs
@@ -27,7 +27,7 @@ use rocket::{
use std::io::Cursor;
markup::define! {
- Layout<'a, Main: Render>(title: String, main: Main, class: Option<&'a str>, session: Option<Session>, show_back: bool) {
+ Layout<'a, Main: Render>(title: String, main: Main, class: Option<&'a str>, session: Option<Session>) {
@markup::doctype()
html {
head {
@@ -37,7 +37,6 @@ markup::define! {
}
body[class=class.unwrap_or("")] {
nav {
- @if *show_back { a[href="javascript:history.back()"] { "<- Back" } } " "
h1 { a[href="/"] { @CONF.brand } } " "
@if let Some(_) = session {
a[href=uri!(r_library_node("library"))] { "My Library" } " "
@@ -80,7 +79,6 @@ 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,
}
@@ -90,7 +88,6 @@ impl Default for LayoutPage<DynRender<'_>> {
class: None,
content: markup::new!(),
title: String::new(),
- show_back: false,
}
}
}
@@ -103,7 +100,6 @@ 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(),
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs
index 773daa4..6256c77 100644
--- a/server/src/routes/ui/node.rs
+++ b/server/src/routes/ui/node.rs
@@ -72,7 +72,6 @@ pub async fn r_library_node_filter<'a>(
Ok(Either::Left(LayoutPage {
title: node.title.to_string(),
- show_back: true, //- !matches!(node.kind, NodeKind::Collection),
content: markup::new! {
@NodePage { node: &node, id: &id, children: &children, filter: &filter }
},
diff --git a/server/src/routes/ui/player.rs b/server/src/routes/ui/player.rs
index 4a636e6..d3a3342 100644
--- a/server/src/routes/ui/player.rs
+++ b/server/src/routes/ui/player.rs
@@ -70,7 +70,6 @@ pub fn r_player<'a>(
}
@conf
},
- show_back: true,
..Default::default()
})
}
diff --git a/web/script/backbutton.ts b/web/script/backbutton.ts
new file mode 100644
index 0000000..c1225c0
--- /dev/null
+++ b/web/script/backbutton.ts
@@ -0,0 +1,8 @@
+import { e } from "./jshelper/mod.ts";
+
+globalThis.addEventListener("DOMContentLoaded", () => {
+ document.getElementsByTagName("nav").item(0)?.prepend(
+ e("a", "<- Back", { onclick() { history.back() } })
+ )
+})
+
diff --git a/web/script/main.ts b/web/script/main.ts
index e2a5045..dd168d5 100644
--- a/web/script/main.ts
+++ b/web/script/main.ts
@@ -5,3 +5,4 @@
*/
import "./player/mod.ts"
import "./transition.ts"
+import "./backbutton.ts"