diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-01-23 18:56:52 +0100 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-01-23 18:56:52 +0100 | 
| commit | 3ca7df883ab71c278086a593ed25699ce6b1a608 (patch) | |
| tree | f8f9d58ecc638c8d1d83ad029cc021e81c3cb533 /server/src/routes | |
| parent | 31675068c5ef1af1c4ae50693ace7ab1b6890393 (diff) | |
| download | jellything-3ca7df883ab71c278086a593ed25699ce6b1a608.tar jellything-3ca7df883ab71c278086a593ed25699ce6b1a608.tar.bz2 jellything-3ca7df883ab71c278086a593ed25699ce6b1a608.tar.zst | |
show node path
Diffstat (limited to 'server/src/routes')
| -rw-r--r-- | server/src/routes/ui/node.rs | 23 | 
1 files changed, 21 insertions, 2 deletions
| diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs index c9adfb6..1a84dc9 100644 --- a/server/src/routes/ui/node.rs +++ b/server/src/routes/ui/node.rs @@ -85,12 +85,28 @@ pub async fn r_library_node_filter<'a>(          .into_iter()          .collect(); +    let path = node +        .path +        .iter() +        .map(|c| { +            Ok(( +                c.to_owned(), +                T_NODE +                    .get(db, c.as_str())? +                    .ok_or(anyhow!("parent node missing"))? +                    .public, +            )) +        }) +        .collect::<anyhow::Result<Vec<_>>>()? +        .into_iter() +        .collect::<Vec<_>>(); +      filter_and_sort_nodes(&filter, &mut children);      Ok(Either::Left(LayoutPage {          title: node.title.clone().unwrap_or_default(),          content: markup::new! { -            @NodePage { node: &node, id: &id, udata: &udata, children: &children, filter: &filter, node_ext: &node_ext } +            @NodePage { node: &node, id: &id, udata: &udata, children: &children, path: &path, filter: &filter, node_ext: &node_ext }          },          ..Default::default()      })) @@ -118,7 +134,7 @@ markup::define! {              }          }      } -    NodePage<'a>(id: &'a str, node: &'a NodePublic, node_ext: &'a ExtendedNode, udata: &'a NodeUserData, children: &'a Vec<(String, NodePublic, NodeUserData)>, filter: &'a NodeFilterSort) { +    NodePage<'a>(id: &'a str, node: &'a NodePublic, node_ext: &'a ExtendedNode, udata: &'a NodeUserData, children: &'a [(String, NodePublic, NodeUserData)], path: &'a [(String, NodePublic)], filter: &'a NodeFilterSort) {          @if !matches!(node.kind.unwrap_or_default(), NodeKind::Collection) {              img.backdrop[src=uri!(r_item_assets(id, AssetRole::Backdrop, Some(2048))), loading="lazy"];          } @@ -128,6 +144,9 @@ markup::define! {              }              .title {                  h1 { @node.title } +                span.path { @for (cid, cnode) in *path { +                    " / " a.component[href=uri!(r_library_node(cid))] { @cnode.title } +                }}                  @if node.media.is_some() { a.play[href=&uri!(r_player(id, PlayerConfig::default()))] { "Watch now" }}                  @if !matches!(node.kind.unwrap_or_default(), NodeKind::Collection | NodeKind::Channel) {                      @if matches!(udata.watched, WatchedState::None | WatchedState::Pending | WatchedState::Progress(_)) { | 
