From 008706a438f8aff064c14fce35b3c12524799b07 Mon Sep 17 00:00:00 2001
From: 0ko <0ko@noreply.codeberg.org>
Date: Thu, 14 Mar 2024 20:59:57 +0500
Subject: [PATCH 001/186] Offer to remove WIP: prefix in sidebar
Fixes https://codeberg.org/forgejo/forgejo/issues/2654
---
options/locale/locale_en-US.ini | 1 +
templates/repo/issue/view_content/sidebar.tmpl | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index a7f4de48a8..cc27509158 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1798,6 +1798,7 @@ pulls.title_wip_desc = `Start the title with %s
pulls.cannot_merge_work_in_progress = This pull request is marked as a work in progress.
pulls.still_in_progress = Still in progress?
pulls.add_prefix = Add %s prefix
+pulls.ready_for_review = Ready for review?
pulls.remove_prefix = Remove %s prefix
pulls.data_broken = This pull request is broken due to missing fork information.
pulls.files_conflicted = This pull request has changes conflicting with the target branch.
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 329a39dd69..75f71c2beb 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -113,10 +113,14 @@
{{end}}
- {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed) (not .IsPullWorkInProgress)}}
+ {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed)}}
{{end}}
From 847f03b6a65ee251bf764f54f6114737346a43b6 Mon Sep 17 00:00:00 2001
From: Denys Konovalov
Date: Fri, 15 Mar 2024 00:24:59 +0100
Subject: [PATCH 002/186] Unify search boxes (#29530)
Unify all but a few search boxes to use uniform style, uniform
translations and shared templates where possible.
Remove a few duplicated search templates, e. g. code search.
Example after screenshots:
![grafik](https://github.com/go-gitea/gitea/assets/47871822/e20e7d6b-c6be-4a47-b132-672766f41421)
![grafik](https://github.com/go-gitea/gitea/assets/47871822/d5b11b9c-c12f-4a29-8fb0-24e5aa511d18)
![grafik](https://github.com/go-gitea/gitea/assets/47871822/d86bb444-36c7-426d-9cf1-c634963dffb1)
![grafik](https://github.com/go-gitea/gitea/assets/47871822/a76c0319-0518-484a-a840-563d02b61198)
Also includes #29700
Co-authored-by: 6543 <6543@obermui.de>
---------
Co-authored-by: 6543
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: silverwind
Co-authored-by: Giteabot
Conflicts:
routers/web/repo/search.go
templates/repo/home.tmpl
templates/repo/search.tmpl
templates/shared/repo_search.tmpl
---
options/locale/locale_en-US.ini | 55 ++--
routers/web/explore/code.go | 5 +-
routers/web/repo/commit.go | 2 +-
routers/web/repo/search.go | 7 +-
routers/web/user/code.go | 5 +-
services/context/pagination.go | 2 +-
templates/admin/base/search.tmpl | 23 --
templates/admin/emails/list.tmpl | 5 +-
templates/admin/org/list.tmpl | 21 +-
templates/admin/packages/list.tmpl | 8 +-
templates/admin/repo/unadopted.tmpl | 8 +-
templates/admin/user/list.tmpl | 6 +-
templates/code/searchcombo.tmpl | 17 --
templates/code/searchform.tmpl | 14 -
templates/explore/code.tmpl | 2 +-
templates/explore/repo_list.tmpl | 2 +-
templates/explore/search.tmpl | 13 +-
templates/explore/user_list.tmpl | 4 +-
templates/explore/users.tmpl | 2 -
templates/org/team/members.tmpl | 2 +-
templates/org/team/repositories.tmpl | 2 +-
templates/package/shared/list.tmpl | 8 +-
templates/package/shared/versionlist.tmpl | 10 +-
templates/projects/list.tmpl | 9 +-
templates/repo/branch/list.tmpl | 262 +++++++++---------
templates/repo/commits_search_dropdown.tmpl | 8 +
templates/repo/commits_table.tmpl | 32 +--
templates/repo/home.tmpl | 4 +-
templates/repo/issue/search.tmpl | 4 +-
templates/repo/search.tmpl | 56 +---
templates/repo/settings/collaboration.tmpl | 4 +-
templates/repo/settings/protected_branch.tmpl | 12 +-
templates/repo/settings/tags.tmpl | 4 +-
templates/shared/actions/runner_list.tmpl | 6 +-
templates/shared/issuelist.tmpl | 2 +-
templates/shared/repo_search.tmpl | 15 +-
templates/shared/search/button.tmpl | 3 +
.../search/code/results.tmpl} | 18 +-
templates/shared/search/code/search.tmpl | 15 +
templates/shared/search/combo.tmpl | 8 +
templates/shared/search/combo_fuzzy.tmpl | 10 +
templates/shared/search/fuzzy.tmpl | 10 +
templates/shared/search/input.tmpl | 4 +
templates/shared/searchinput.tmpl | 1 -
templates/user/code.tmpl | 4 +-
templates/user/dashboard/issues.tmpl | 4 +-
templates/user/dashboard/milestones.tmpl | 7 +-
templates/user/dashboard/repolist.tmpl | 2 +-
web_src/css/base.css | 26 +-
web_src/css/form.css | 5 +
50 files changed, 354 insertions(+), 404 deletions(-)
delete mode 100644 templates/admin/base/search.tmpl
delete mode 100644 templates/code/searchcombo.tmpl
delete mode 100644 templates/code/searchform.tmpl
create mode 100644 templates/repo/commits_search_dropdown.tmpl
create mode 100644 templates/shared/search/button.tmpl
rename templates/{code/searchresults.tmpl => shared/search/code/results.tmpl} (70%)
create mode 100644 templates/shared/search/code/search.tmpl
create mode 100644 templates/shared/search/combo.tmpl
create mode 100644 templates/shared/search/combo_fuzzy.tmpl
create mode 100644 templates/shared/search/fuzzy.tmpl
create mode 100644 templates/shared/search/input.tmpl
delete mode 100644 templates/shared/searchinput.tmpl
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 647c46b5a9..1308ae6741 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -156,6 +156,27 @@ filter.not_template = Not Template
filter.public = Public
filter.private = Private
+[search]
+search = Search...
+type_tooltip = Search type
+fuzzy = Fuzzy
+fuzzy_tooltip = Include results that also match the search term closely
+match = Match
+match_tooltip = Include only results that match the exact search term
+repo_kind = Search repos...
+user_kind = Search users...
+org_kind = Search orgs...
+team_kind = Search teams...
+code_kind = Search code...
+code_search_unavailable = Code search is currently not available. Please contact the site administrator.
+package_kind = Search packages...
+project_kind = Search projects...
+branch_kind = Search branches...
+commit_kind = Search commits...
+runner_kind = Search runners...
+no_results = No matching results found.
+keyword_search_unavailable = Searching by keyword is currently not available. Please contact the site administrator.
+
[aria]
navbar = Navigation Bar
footer = Footer
@@ -336,7 +357,6 @@ my_orgs = Organizations
show_more_repos = Show more repositories…
collaborative_repos = Collaborative Repositories
view_home = View %s
-search_repos = Find a repository…
filter = Other Filters
filter_by_team_repositories = Filter by team repositories
feed_of = Feed of "%s"
@@ -361,20 +381,8 @@ stars_few = %d stars
forks_one = %d fork
forks_few = %d forks
organizations = Organizations
-search = Search
go_to = Go to
code = Code
-search.type.tooltip = Search type
-search.fuzzy = Fuzzy
-search.fuzzy.tooltip = Include results that also matches the search term closely
-search.match = Match
-search.match.tooltip = Include only results that matches the exact search term
-code_search_unavailable = Currently code search is not available. Please contact your site administrator.
-repo_no_results = No matching repositories found.
-user_no_results = No matching users found.
-org_no_results = No matching organizations found.
-code_no_results = No source code matching your search term found.
-code_search_results = Search results for "%s"
code_last_indexed_at = Last indexed %s
relevant_repositories_tooltip = Repositories that are forks or that have no topic, no icon, and no description are hidden.
relevant_repositories = Only relevant repositories are being shown, show unfiltered results.
@@ -1343,9 +1351,8 @@ commits.desc = Browse source code change history.
commits.commits = Commits
commits.no_commits = No commits in common. "%s" and "%s" have entirely different histories.
commits.nothing_to_compare = These branches are equal.
-commits.search = Search commits…
commits.search.tooltip = You can prefix keywords with "author:", "committer:", "after:", or "before:", e.g. "revert author:Alice before:2019-01-13".
-commits.find = Search
+commits.search_branch = This Branch
commits.search_all = All Branches
commits.author = Author
commits.message = Message
@@ -1521,7 +1528,6 @@ issues.filter_sort.moststars = Most stars
issues.filter_sort.feweststars = Fewest stars
issues.filter_sort.mostforks = Most forks
issues.filter_sort.fewestforks = Fewest forks
-issues.keyword_search_unavailable = Searching by keyword is currently not available. Please contact your site administrator.
issues.action_open = Open
issues.action_close = Close
issues.action_label = Label
@@ -2062,17 +2068,6 @@ contributors.contribution_type.commits = Commits
contributors.contribution_type.additions = Additions
contributors.contribution_type.deletions = Deletions
-search = Search
-search.search_repo = Search repository
-search.type.tooltip = Search type
-search.fuzzy = Fuzzy
-search.fuzzy.tooltip = Include results that also matches the search term closely
-search.match = Match
-search.match.tooltip = Include only results that matches the exact search term
-search.results = Search results for "%s" in %s
-search.code_no_results = No source code matching your search term found.
-search.code_search_unavailable = Currently code search is not available. Please contact your site administrator.
-
settings = Settings
settings.desc = Settings is where you can manage the settings for the repository
settings.options = Repository
@@ -2241,7 +2236,6 @@ settings.delete_collaborator = Remove
settings.collaborator_deletion = Remove Collaborator
settings.collaborator_deletion_desc = Removing a collaborator will revoke their access to this repository. Continue?
settings.remove_collaborator_success = The collaborator has been removed.
-settings.search_user_placeholder = Search user…
settings.org_not_allowed_to_be_collaborator = Organizations cannot be added as a collaborator.
settings.change_team_access_not_allowed = Changing team access for repository has been restricted to organization owner
settings.team_not_in_organization = The team is not in the same organization as the repository
@@ -2249,7 +2243,6 @@ settings.teams = Teams
settings.add_team = Add team
settings.add_team_duplicate = Team already has the repository
settings.add_team_success = The team now have access to the repository.
-settings.search_team = Search team…
settings.change_team_permission_tip = Team's permission is set on the team setting page and can't be changed per repository
settings.delete_team_tip = This team has access to all repositories and can't be removed
settings.remove_team_success = The team's access to the repository has been removed.
@@ -2403,9 +2396,7 @@ settings.protect_whitelist_committers = Whitelist restricted push
settings.protect_whitelist_committers_desc = Only whitelisted users or teams will be allowed to push to this branch (but not force push).
settings.protect_whitelist_deploy_keys = Whitelist deploy keys with write access to push.
settings.protect_whitelist_users = Whitelisted users for pushing:
-settings.protect_whitelist_search_users = Search users…
settings.protect_whitelist_teams = Whitelisted teams for pushing:
-settings.protect_whitelist_search_teams = Search teams…
settings.protect_merge_whitelist_committers = Enable merge whitelist
settings.protect_merge_whitelist_committers_desc = Allow only whitelisted users or teams to merge pull requests into this branch.
settings.protect_merge_whitelist_users = Whitelisted users for merging:
@@ -2650,7 +2641,6 @@ branch.default_deletion_failed = Branch "%s" is the default branch. It cannot be
branch.restore = Restore branch "%s"
branch.download = Download branch "%s"
branch.rename = Rename branch "%s"
-branch.search = Search branch
branch.included_desc = This branch is part of the default branch
branch.included = Included
branch.create_new_branch = Create branch from branch:
@@ -2797,7 +2787,6 @@ teams.write_permission_desc = This team grants Write access: me
teams.admin_permission_desc = This team grants Admin access: members can read from, push to and add collaborators to team repositories.
teams.create_repo_permission_desc = Additionally, this team grants Create repository permission: members can create new repositories in organization.
teams.repositories = Team repositories
-teams.search_repo_placeholder = Search repository…
teams.remove_all_repos_title = Remove all team repositories
teams.remove_all_repos_desc = This will remove all repositories from the team.
teams.add_all_repos_title = Add all repositories
diff --git a/routers/web/explore/code.go b/routers/web/explore/code.go
index 75bd0f3d24..f61b832572 100644
--- a/routers/web/explore/code.go
+++ b/routers/web/explore/code.go
@@ -35,12 +35,11 @@ func Code(ctx *context.Context) {
language := ctx.FormTrim("l")
keyword := ctx.FormTrim("q")
- queryType := ctx.FormTrim("t")
- isFuzzy := queryType != "match"
+ isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
ctx.Data["Keyword"] = keyword
ctx.Data["Language"] = language
- ctx.Data["queryType"] = queryType
+ ctx.Data["IsFuzzy"] = isFuzzy
ctx.Data["PageIsViewCode"] = true
if keyword == "" {
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go
index 7c89ce5a38..0c585a93b8 100644
--- a/routers/web/repo/commit.go
+++ b/routers/web/repo/commit.go
@@ -203,7 +203,7 @@ func SearchCommits(ctx *context.Context) {
ctx.Data["Keyword"] = query
if all {
- ctx.Data["All"] = "checked"
+ ctx.Data["All"] = true
}
ctx.Data["Username"] = ctx.Repo.Owner.Name
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
diff --git a/routers/web/repo/search.go b/routers/web/repo/search.go
index d22a691a70..273b90c97e 100644
--- a/routers/web/repo/search.go
+++ b/routers/web/repo/search.go
@@ -21,12 +21,11 @@ func Search(ctx *context.Context) {
language := ctx.FormTrim("l")
keyword := ctx.FormTrim("q")
- queryType := ctx.FormTrim("t")
- isFuzzy := queryType != "match"
+ isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
ctx.Data["Keyword"] = keyword
ctx.Data["Language"] = language
- ctx.Data["queryType"] = queryType
+ ctx.Data["IsFuzzy"] = isFuzzy
ctx.Data["PageIsViewCode"] = true
if keyword == "" {
@@ -34,7 +33,7 @@ func Search(ctx *context.Context) {
return
}
- ctx.Data["SourcePath"] = ctx.Repo.Repository.Link()
+ ctx.Data["Repo"] = ctx.Repo.Repository
page := ctx.FormInt("page")
if page <= 0 {
diff --git a/routers/web/user/code.go b/routers/web/user/code.go
index d2afdd8905..e2e8f25661 100644
--- a/routers/web/user/code.go
+++ b/routers/web/user/code.go
@@ -40,12 +40,11 @@ func CodeSearch(ctx *context.Context) {
language := ctx.FormTrim("l")
keyword := ctx.FormTrim("q")
- queryType := ctx.FormTrim("t")
- isFuzzy := queryType != "match"
+ isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
ctx.Data["Keyword"] = keyword
ctx.Data["Language"] = language
- ctx.Data["queryType"] = queryType
+ ctx.Data["IsFuzzy"] = isFuzzy
ctx.Data["IsCodePage"] = true
if keyword == "" {
diff --git a/services/context/pagination.go b/services/context/pagination.go
index 68237c630c..655a278f9f 100644
--- a/services/context/pagination.go
+++ b/services/context/pagination.go
@@ -53,5 +53,5 @@ func (p *Pagination) SetDefaultParams(ctx *Context) {
p.AddParam(ctx, "sort", "SortType")
p.AddParam(ctx, "q", "Keyword")
// do not add any more uncommon params here!
- p.AddParam(ctx, "t", "queryType")
+ p.AddParam(ctx, "fuzzy", "IsFuzzy")
}
diff --git a/templates/admin/base/search.tmpl b/templates/admin/base/search.tmpl
deleted file mode 100644
index 0fecb61d9e..0000000000
--- a/templates/admin/base/search.tmpl
+++ /dev/null
@@ -1,23 +0,0 @@
-
diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl
index 29fbb5f039..1e552fba88 100644
--- a/templates/admin/emails/list.tmpl
+++ b/templates/admin/emails/list.tmpl
@@ -6,10 +6,7 @@
{{.Milestone.Name}}
{{if not .Repository.IsArchived}} -{{ctx.Locale.Tr "repo.pulls.merged_success"}} @@ -48,7 +48,7 @@
{{ctx.Locale.Tr "repo.pulls.closed"}}
-
{{RenderIssueTitle $.Context .Issue.Title ($.Repository.ComposeMetas ctx) | RenderCodeBlock}} #{{.Issue.Index}} -
+
diff --git a/templates/repo/migrate/migrate.tmpl b/templates/repo/migrate/migrate.tmpl
index 8ba567ee6b..c0336b9b97 100644
--- a/templates/repo/migrate/migrate.tmpl
+++ b/templates/repo/migrate/migrate.tmpl
@@ -5,7 +5,7 @@
{{template "repo/migrate/helper" .}}
{{range .Services}}
-
+
{{if eq .Name "github"}}
{{svg "octicon-mark-github" 184 "gt-p-4"}}
{{else if eq .Name "gitlab"}}
diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl
index 377a7ff79f..b227ce4439 100644
--- a/templates/repo/projects/view.tmpl
+++ b/templates/repo/projects/view.tmpl
@@ -2,7 +2,7 @@
{{template "repo/header" .}}
-
+
{{template "repo/issue/navbar" .}}
{{ctx.Locale.Tr "repo.issues.new"}}
diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl
index f0907f409b..2cf0a85fc8 100644
--- a/templates/repo/pulls/fork.tmpl
+++ b/templates/repo/pulls/fork.tmpl
@@ -37,7 +37,7 @@
- {{.ForkRepo.FullName}}
+ {{.ForkRepo.FullName}}
diff --git a/templates/repo/pulls/tab_menu.tmpl b/templates/repo/pulls/tab_menu.tmpl
index 340b1bb397..fb00acde32 100644
--- a/templates/repo/pulls/tab_menu.tmpl
+++ b/templates/repo/pulls/tab_menu.tmpl
@@ -15,7 +15,7 @@
{{ctx.Locale.Tr "repo.pulls.tab_files"}}
{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}
-
+
{{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}} {{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}
diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl
index 30e783167c..fd6338a701 100644
--- a/templates/repo/release/new.tmpl
+++ b/templates/repo/release/new.tmpl
@@ -21,7 +21,7 @@
{{else}}
-
+
@
@@ -61,7 +61,7 @@
{{range .attachments}}
-
+