aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/browser.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-07-31 19:53:01 +0200
committermetamuffin <metamuffin@disroot.org>2023-07-31 19:53:01 +0200
commitaeafba7847e189313df3025e6d6f291999b57350 (patch)
treebf7affdca28208695648bc9b18856cbb7049d1e8 /server/src/routes/ui/browser.rs
parent0c651f11920350a4aa96aa24f8fe15b28390aed2 (diff)
downloadjellything-aeafba7847e189313df3025e6d6f291999b57350.tar
jellything-aeafba7847e189313df3025e6d6f291999b57350.tar.bz2
jellything-aeafba7847e189313df3025e6d6f291999b57350.tar.zst
update server to new schema
Diffstat (limited to 'server/src/routes/ui/browser.rs')
-rw-r--r--server/src/routes/ui/browser.rs31
1 files changed, 10 insertions, 21 deletions
diff --git a/server/src/routes/ui/browser.rs b/server/src/routes/ui/browser.rs
index 30eb3f2..767e411 100644
--- a/server/src/routes/ui/browser.rs
+++ b/server/src/routes/ui/browser.rs
@@ -3,35 +3,24 @@
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, node::PosterCard};
-use crate::library::{Library, Node};
+use super::{account::session::Session, error::MyError, layout::DynLayoutPage};
+use crate::database::Database;
use rocket::{get, State};
-use std::collections::VecDeque;
#[get("/items")]
-pub fn r_all_items(_sess: Session, library: &State<Library>) -> Result<DynLayoutPage<'_>, MyError> {
- let mut dirs = VecDeque::from_iter(Some(library.root.get_directory().unwrap()));
- let mut items = Vec::new();
- while let Some(d) = dirs.pop_front() {
- for e in &d.children {
- match e.as_ref() {
- Node::Directory(d) => dirs.push_back(d.clone()),
- Node::Item(i) => items.push(i.clone()),
- }
- }
- }
+pub fn r_all_items(_sess: Session, db: &State<Database>) -> Result<DynLayoutPage<'_>, MyError> {
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 item in &items {
+ // li {@PosterCard {
+ // wide: false, dir: false,
+ // path: item.lib_path.clone(),
+ // title: &item.info.title
+ // }}
+ // }}
}
},
..Default::default()