Move global issue/pull sidebar filter into an option (#4096)

Sidebar repo filtering was removed in gitea1.22-legacy, so in Forgejo 7.0. Now it only has filtering based on issue/pull type (created by me, i'm assigned..), which can easily fit into a regular filtering option to be consistent with other UI pages: subscriptions and repo issues.

* move these filtering from sidebar to a "Type" option. You can find the same option in repo issues

Affected pages (you can view how "Before" looks like here):
* https://codeberg.org/issues
* https://codeberg.org/pulls
* https://codeberg.org/org/forgejo/issues
* https://codeberg.org/org/forgejo/pulls

## Preview

https://codeberg.org/attachments/652db186-9bd4-414b-ae0e-06a11f9c1abd
https://codeberg.org/attachments/76c2b040-0900-4fed-aa69-e76d31072fa7

## The inspiration

This PR improves consistency with repo issues/pulls view:

https://codeberg.org/attachments/2f503ca7-89a0-4c0a-ad37-b0d7755e044d

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4096
Reviewed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
This commit is contained in:
0ko 2024-06-15 16:11:31 +00:00
parent 221ca0c404
commit 291e145ac5

View file

@ -3,38 +3,6 @@
{{template "user/dashboard/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
<div class="flex-container">
<div class="flex-container-nav">
<div class="ui secondary vertical filter menu tw-bg-transparent">
<a class="{{if eq .ViewType "your_repositories"}}active{{end}} item" href="?type=your_repositories&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{ctx.Locale.Tr "home.issues.in_your_repos"}}
<strong>{{CountFmt .IssueStats.YourRepositoriesCount}}</strong>
</a>
<a class="{{if eq .ViewType "assigned"}}active{{end}} item" href="?type=assigned&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{ctx.Locale.Tr "repo.issues.filter_type.assigned_to_you"}}
<strong>{{CountFmt .IssueStats.AssignCount}}</strong>
</a>
<a class="{{if eq .ViewType "created_by"}}active{{end}} item" href="?type=created_by&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{ctx.Locale.Tr "repo.issues.filter_type.created_by_you"}}
<strong>{{CountFmt .IssueStats.CreateCount}}</strong>
</a>
{{if .PageIsPulls}}
<a class="{{if eq .ViewType "review_requested"}}active{{end}} item" href="?type=review_requested&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{ctx.Locale.Tr "repo.issues.filter_type.review_requested"}}
<strong>{{CountFmt .IssueStats.ReviewRequestedCount}}</strong>
</a>
<a class="{{if eq .ViewType "reviewed_by"}}active{{end}} item" href="?type=reviewed_by&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{ctx.Locale.Tr "repo.issues.filter_type.reviewed_by_you"}}
<strong>{{CountFmt .IssueStats.ReviewedCount}}</strong>
</a>
{{end}}
<a class="{{if eq .ViewType "mentioned"}}active{{end}} item" href="?type=mentioned&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
{{ctx.Locale.Tr "repo.issues.filter_type.mentioning_you"}}
<strong>{{CountFmt .IssueStats.MentionCount}}</strong>
</a>
</div>
</div>
<div class="flex-container-main content">
<div class="list-header">
<div class="small-menu-items ui compact tiny menu list-header-toggle">
<a class="item{{if not .IsShowClosed}} active{{end}}" href="?type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&q={{$.Keyword}}">
@ -56,12 +24,48 @@
{{template "shared/search/button"}}
</div>
</form>
<div class="ui secondary menu tw-mt-0">
<!-- Label -->
{{if .PageIsOrgIssues}}
{{template "shared/label_filter" .}}
{{end}}
<!-- Type -->
<div class="list-header ui dropdown type jump item">
<span class="text tw-whitespace-nowrap">
{{ctx.Locale.Tr "repo.issues.filter_type"}}
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
</span>
<div class="ui menu">
<a class="{{if eq .ViewType "your_repositories"}}active{{end}} item" href="?type=your_repositories&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
<div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.YourRepositoriesCount}}</div>
{{ctx.Locale.Tr "home.issues.in_your_repos"}}
</a>
<a class="{{if eq .ViewType "assigned"}}active{{end}} item" href="?type=assigned&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
<div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.AssignCount}}</div>
{{ctx.Locale.Tr "repo.issues.filter_type.assigned_to_you"}}
</a>
<a class="{{if eq .ViewType "created_by"}}active{{end}} item" href="?type=created_by&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
<div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.CreateCount}}</div>
{{ctx.Locale.Tr "repo.issues.filter_type.created_by_you"}}
</a>
{{if .PageIsPulls}}
<a class="{{if eq .ViewType "review_requested"}}active{{end}} item" href="?type=review_requested&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
<div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.ReviewRequestedCount}}</div>
{{ctx.Locale.Tr "repo.issues.filter_type.review_requested"}}
</a>
<a class="{{if eq .ViewType "reviewed_by"}}active{{end}} item" href="?type=reviewed_by&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
<div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.ReviewedCount}}</div>
{{ctx.Locale.Tr "repo.issues.filter_type.reviewed_by_you"}}
</a>
{{end}}
<a class="{{if eq .ViewType "mentioned"}}active{{end}} item" href="?type=mentioned&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}">
<div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.MentionCount}}</div>
{{ctx.Locale.Tr "repo.issues.filter_type.mentioning_you"}}
</a>
</div>
</div>
<!-- Sort -->
<div class="list-header-sort ui small dropdown type jump item">
<div class="list-header-sort ui dropdown type jump item">
<span class="text tw-whitespace-nowrap">
{{ctx.Locale.Tr "repo.issues.filter_sort"}}
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
@ -78,9 +82,8 @@
</div>
</div>
</div>
</div>
{{template "shared/issuelist" dict "." . "listType" "dashboard"}}
</div>
</div>
</div>
</div>
{{template "base/footer" .}}