diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-29 11:10:21 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-29 11:10:21 +0200 |
commit | f62c7f2a8cc143454779dc99334ca9fc80ddabd5 (patch) | |
tree | f31dbb908715d2deb2860e2097fa13dd41d759d5 /server/src/ui/browser.rs | |
parent | 73d2d5eb01fceae9e0b1c58afb648822000c878a (diff) | |
download | jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar.bz2 jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar.zst |
still just moving code around
Diffstat (limited to 'server/src/ui/browser.rs')
-rw-r--r-- | server/src/ui/browser.rs | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/server/src/ui/browser.rs b/server/src/ui/browser.rs deleted file mode 100644 index b780934..0000000 --- a/server/src/ui/browser.rs +++ /dev/null @@ -1,61 +0,0 @@ -/* - This file is part of jellything (https://codeberg.org/metamuffin/jellything) - which is licensed under the GNU Affero General Public License (version 3); see /COPYING. - Copyright (C) 2025 metamuffin <metamuffin.org> -*/ -use super::{ - error::MyError, - layout::{trs, DynLayoutPage, LayoutPage}, - node::NodeCard, - sort::{filter_and_sort_nodes, NodeFilterSort, NodeFilterSortForm, SortOrder, SortProperty}, -}; -use crate::{ - api::AcceptJson, database::Database, locale::AcceptLanguage, logic::session::Session, uri, -}; -use jellybase::locale::tr; -use jellycommon::{api::ApiItemsResponse, Visibility}; -use rocket::{get, serde::json::Json, Either, State}; - -/// This function is a stub and only useful for use in the uri! macro. -#[get("/items")] -pub fn r_all_items() {} - -#[get("/items?<page>&<filter..>")] -pub fn r_all_items_filter( - sess: Session, - db: &State<Database>, - aj: AcceptJson, - page: Option<usize>, - filter: NodeFilterSort, - lang: AcceptLanguage, -) -> Result<Either<DynLayoutPage<'_>, Json<ApiItemsResponse>>, MyError> { - let AcceptLanguage(lang) = lang; - - let data = all_items()?; - Ok(if *aj { - Either::Right(Json(data)) - } else { - Either::Left(LayoutPage { - title: "All Items".to_owned(), - content: markup::new! { - .page.dir { - h1 { "All Items" } - @NodeFilterSortForm { f: &filter, lang: &lang } - ul.children { @for (node, udata) in &items[from..to] { - li {@NodeCard { node, udata, lang: &lang }} - }} - p.pagecontrols { - span.current { @tr(lang, "page.curr").replace("{cur}", &(page + 1).to_string()).replace("{max}", &max_page.to_string()) " " } - @if page > 0 { - a.prev[href=uri!(r_all_items_filter(Some(page - 1), filter.clone()))] { @trs(&lang, "page.prev") } " " - } - @if page + 1 < max_page { - a.next[href=uri!(r_all_items_filter(Some(page + 1), filter.clone()))] { @trs(&lang, "page.next") } - } - } - } - }, - ..Default::default() - }) - }) -} |