From 5e8a830505eb622772e289ee577dbe75aa082efa Mon Sep 17 00:00:00 2001 From: Bartlomiej Komendarczuk Date: Tue, 16 Jul 2024 10:08:54 +0200 Subject: [PATCH 1/2] [PORT] Added default sorting milestones by name (gitea#27084) Resolves https://github.com/go-gitea/gitea/issues/26996 Added default sorting for milestones by name. Co-authored-by: Lunny Xiao --- Conflict resolution: trivial, was due to the improvement made to 'the due date sorting' strings. (cherry picked from commit e8d4b7a8b198eca3b0bd117efb422d7d7cac93fe) --- models/issues/milestone_list.go | 4 +++- options/locale/locale_en-US.ini | 1 + templates/repo/issue/milestone/filter_list.tmpl | 1 + templates/user/dashboard/milestones.tmpl | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/models/issues/milestone_list.go b/models/issues/milestone_list.go index d1b3f0301b..955ab2356d 100644 --- a/models/issues/milestone_list.go +++ b/models/issues/milestone_list.go @@ -70,8 +70,10 @@ func (opts FindMilestoneOptions) ToOrders() string { return "num_issues DESC" case "id": return "id ASC" + case "name": + return "name DESC" default: - return "deadline_unix ASC, id ASC" + return "deadline_unix ASC, name ASC" } } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 4da9a9afd8..2c34025bef 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1996,6 +1996,7 @@ milestones.edit_success = Milestone "%s" has been updated. milestones.deletion = Delete milestone milestones.deletion_desc = Deleting a milestone removes it from all related issues. Continue? milestones.deletion_success = The milestone has been deleted. +milestones.filter_sort.name = Name milestones.filter_sort.earliest_due_data = Nearest due date milestones.filter_sort.latest_due_date = Farthest due date milestones.filter_sort.least_complete = Least complete diff --git a/templates/repo/issue/milestone/filter_list.tmpl b/templates/repo/issue/milestone/filter_list.tmpl index ecfb95bb13..fe6e1a2211 100644 --- a/templates/repo/issue/milestone/filter_list.tmpl +++ b/templates/repo/issue/milestone/filter_list.tmpl @@ -11,5 +11,6 @@ {{ctx.Locale.Tr "repo.milestones.filter_sort.most_complete"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}} + {{ctx.Locale.Tr "repo.milestones.filter_sort.name"}} diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 0f1e866a21..71ff8dba3f 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -65,6 +65,7 @@ {{ctx.Locale.Tr "repo.milestones.filter_sort.most_complete"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}} + {{ctx.Locale.Tr "repo.milestones.filter_sort.name"}} From b67fa954a6057e97e2c76d1443fe65b17bf99fab Mon Sep 17 00:00:00 2001 From: Gusted Date: Mon, 22 Jul 2024 15:01:36 +0200 Subject: [PATCH 2/2] Make it consistent with the other sorting filters --- templates/repo/issue/milestone/filter_list.tmpl | 2 +- templates/user/dashboard/milestones.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/issue/milestone/filter_list.tmpl b/templates/repo/issue/milestone/filter_list.tmpl index fe6e1a2211..cc45d3b922 100644 --- a/templates/repo/issue/milestone/filter_list.tmpl +++ b/templates/repo/issue/milestone/filter_list.tmpl @@ -11,6 +11,6 @@ {{ctx.Locale.Tr "repo.milestones.filter_sort.most_complete"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}} - {{ctx.Locale.Tr "repo.milestones.filter_sort.name"}} + {{ctx.Locale.Tr "repo.milestones.filter_sort.name"}} diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 71ff8dba3f..fe8e246db6 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -65,7 +65,7 @@ {{ctx.Locale.Tr "repo.milestones.filter_sort.most_complete"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}} - {{ctx.Locale.Tr "repo.milestones.filter_sort.name"}} + {{ctx.Locale.Tr "repo.milestones.filter_sort.name"}}