diff options
author | metamuffin <metamuffin@disroot.org> | 2023-07-31 20:28:38 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-07-31 20:28:38 +0200 |
commit | 30306bcf5a312c8749b1b66ef0a426cf7aaee989 (patch) | |
tree | 74836ccee827589b3606c65f8502e4e6ef13d880 /server/src/routes/ui/browser.rs | |
parent | aeafba7847e189313df3025e6d6f291999b57350 (diff) | |
download | jellything-30306bcf5a312c8749b1b66ef0a426cf7aaee989.tar jellything-30306bcf5a312c8749b1b66ef0a426cf7aaee989.tar.bz2 jellything-30306bcf5a312c8749b1b66ef0a426cf7aaee989.tar.zst |
images loading again
Diffstat (limited to 'server/src/routes/ui/browser.rs')
-rw-r--r-- | server/src/routes/ui/browser.rs | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/server/src/routes/ui/browser.rs b/server/src/routes/ui/browser.rs index 767e411..e7f7d96 100644 --- a/server/src/routes/ui/browser.rs +++ b/server/src/routes/ui/browser.rs @@ -3,24 +3,35 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2023 metamuffin <metamuffin.org> */ -use super::{account::session::Session, error::MyError, layout::DynLayoutPage}; +use super::{account::session::Session, error::MyError, layout::DynLayoutPage, node::PosterCard}; use crate::database::Database; +use anyhow::Context; +use jellycommon::{Node, NodeKind}; use rocket::{get, State}; #[get("/items")] pub fn r_all_items(_sess: Session, db: &State<Database>) -> Result<DynLayoutPage<'_>, MyError> { + let items = db + .node + .iter() + .map(|e| e.context("listing")) + .collect::<anyhow::Result<Vec<_>>>()? + .into_iter() + .filter(|(_, n)| matches!(n.public.kind, NodeKind::Movie | NodeKind::Series)) + .collect::<Vec<(String, Node)>>(); + Ok(super::layout::LayoutPage { title: "All Items".to_owned(), content: markup::new! { .page.dir { h1 { "All Items" } - // ul.directorylisting { @for item in &items { - // li {@PosterCard { - // wide: false, dir: false, - // path: item.lib_path.clone(), - // title: &item.info.title - // }} - // }} + ul.directorylisting { @for (id, node) in &items { + li {@PosterCard { + wide: false, dir: false, + id, + title: &node.public.title + }} + }} } }, ..Default::default() |