diff options
Diffstat (limited to 'server/src/routes/ui/sort.rs')
-rw-r--r-- | server/src/routes/ui/sort.rs | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/server/src/routes/ui/sort.rs b/server/src/routes/ui/sort.rs index 6bee2ef..4906c43 100644 --- a/server/src/routes/ui/sort.rs +++ b/server/src/routes/ui/sort.rs @@ -1,3 +1,4 @@ +use jellybase::locale::Language; use jellycommon::{helpers::SortAnyway, user::NodeUserData, Node, NodeKind, Rating}; use markup::RenderAttributeValue; use rocket::{ @@ -6,6 +7,8 @@ use rocket::{ }; use std::sync::Arc; +use crate::routes::ui::layout::trs; + #[derive(FromForm, UriDisplayQuery, Default, Clone)] pub struct NodeFilterSort { pub sort_by: Option<SortProperty>, @@ -64,22 +67,25 @@ impl SortProperty { use SortProperty::*; &[ ( - "General", - &[(Title, "Title"), (ReleaseDate, "Release Date")], + "filter_sort.sort.general", + &[(Title, "node.title"), (ReleaseDate, "node.release_date")], ), - ("Media", &[(Duration, "Runtime")]), + ("filter_sort.sort.media", &[(Duration, "media.runtime")]), ( - "By Rating", + "filter_sort.sort.rating", &[ - (RatingImdb, "IMDb Rating"), - (RatingTmdb, "TMDB Rating"), - (RatingMetacritic, "Metacritic Rating"), - (RatingRottenTomatoes, "Rotten Tomatoes"), - (RatingYoutubeFollowers, "Youtube Subscribers"), - (RatingYoutubeLikes, "Youtube Likes"), - (RatingYoutubeViews, "Youtube Views"), - (RatingUser, "Your Rating"), - (RatingLikesDivViews, "Likes per view"), + (RatingImdb, "rating.imdb"), + (RatingTmdb, "rating.tmdb"), + (RatingMetacritic, "rating.metacritic"), + (RatingRottenTomatoes, "rating.rotten_tomatoes"), + (RatingYoutubeFollowers, "rating.youtube_followers"), + (RatingYoutubeLikes, "rating.youtube_likes"), + (RatingYoutubeViews, "rating.youtube_views"), + (RatingUser, "filter_sort.sort.rating.user"), + ( + RatingLikesDivViews, + "filter_sort.sort.rating.likes_div_views", + ), ], ), ] @@ -90,30 +96,30 @@ impl FilterProperty { use FilterProperty::*; &[ ( - "By Kind", + "filter_sort.filter.kind", &[ - (KindMovie, "Movie"), - (KindVideo, "Video"), - (KindShortFormVideo, "Short Form Video"), - (KindMusic, "Music"), - (KindCollection, "Collection"), - (KindChannel, "Channel"), - (KindShow, "Show"), - (KindSeries, "Series"), - (KindSeason, "Season"), - (KindEpisode, "Episode"), + (KindMovie, "kind.movie"), + (KindVideo, "kind.video"), + (KindShortFormVideo, "kind.short_form_video"), + (KindMusic, "kind.music"), + (KindCollection, "kind.collection"), + (KindChannel, "kind.channel"), + (KindShow, "kind.show"), + (KindSeries, "kind.series"), + (KindSeason, "kind.season"), + (KindEpisode, "kind.episode"), ], ), ( - "By Federation", + "filter_sort.filter.federation", &[(FederationLocal, "Local"), (FederationRemote, "Remote")], ), ( - "By Watched", + "filter_sort.filter.watched", &[ - (Watched, "Watched"), - (Unwatched, "Unwatched"), - (WatchProgress, "Partially Watched"), + (Watched, "watched.watched"), + (Unwatched, "watched.none"), + (WatchProgress, "watched.progress"), ], ), ] @@ -221,7 +227,7 @@ pub fn filter_and_sort_nodes( } markup::define! { - NodeFilterSortForm<'a>(f: &'a NodeFilterSort) { + NodeFilterSortForm<'a>(f: &'a NodeFilterSort, lang: &'a Language) { details.filtersort[open=f.is_open()] { summary { "Filter and Sort" } form[method="GET", action=""] { @@ -232,7 +238,7 @@ markup::define! { .category { h3 { @cname } @for (value, label) in *cat { - label { input[type="checkbox", name="filter_kind", value=value, checked=f.filter_kind.as_ref().map(|k|k.contains(value)).unwrap_or(true)]; @label } br; + label { input[type="checkbox", name="filter_kind", value=value, checked=f.filter_kind.as_ref().map(|k|k.contains(value)).unwrap_or(true)]; @trs(lang, label) } br; } } } @@ -245,7 +251,7 @@ markup::define! { .category { h3 { @cname } @for (value, label) in *cat { - label { input[type="radio", name="sort_by", value=value, checked=Some(value)==f.sort_by.as_ref()]; @label } br; + label { input[type="radio", name="sort_by", value=value, checked=Some(value)==f.sort_by.as_ref()]; @trs(lang, label) } br; } } } @@ -255,7 +261,7 @@ markup::define! { legend { "Sort Order" } @use SortOrder::*; @for (value, label) in [(Ascending, "Ascending"), (Descending, "Descending")] { - label { input[type="radio", name="sort_order", value=value, checked=Some(value)==f.sort_order]; @label } br; + label { input[type="radio", name="sort_order", value=value, checked=Some(value)==f.sort_order]; @trs(lang, label) } br; } } input[type="submit", value="Apply"]; a[href="?"] { "Clear" } |