From 57683d1cfbea75bb3f95da3653ca40ea5bea5edb Mon Sep 17 00:00:00 2001 From: Leeingnyo Date: Fri, 24 Dec 2021 16:29:55 +0900 Subject: [PATCH] Add sort option "Name" for title --- src/util/util.cr | 2 ++ src/views/library.html.ecr | 1 + 2 files changed, 3 insertions(+) diff --git a/src/util/util.cr b/src/util/util.cr index 9f5ffee..7278bb2 100644 --- a/src/util/util.cr +++ b/src/util/util.cr @@ -98,6 +98,8 @@ def sort_titles(titles : Array(Title), opt : SortOptions, username : String) (a.load_percentage(username) <=> b.load_percentage(username)).or \ compare_numerically a.title, b.title end + when .title? + ary.sort! { |a, b| compare_numerically a.title, b.title } else unless opt.method.auto? Logger.warn "Unknown sorting method #{opt.not_nil!.method}. Using " \ diff --git a/src/views/library.html.ecr b/src/views/library.html.ecr index 39e9856..a5e8b59 100644 --- a/src/views/library.html.ecr +++ b/src/views/library.html.ecr @@ -10,6 +10,7 @@
<% hash = { "auto" => "Auto", + "title" => "Name", "time_modified" => "Date Modified", "progress" => "Progress" } %>