diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 836703a480..8c014955d0 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -155,6 +155,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 @@ -330,7 +351,6 @@ collaborative_repos = Collaborative Repositories my_orgs = My Organizations my_mirrors = My Mirrors 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" @@ -351,20 +371,8 @@ issues.in_your_repos = In your repositories repos = Repositories users = Users 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. @@ -1324,9 +1332,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 @@ -1502,7 +1509,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 @@ -2035,17 +2041,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 @@ -2206,7 +2201,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 @@ -2214,7 +2208,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. @@ -2367,9 +2360,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: @@ -2614,7 +2605,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: @@ -2760,7 +2750,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 a6bc71ac9c..7ba5984002 100644 --- a/routers/web/explore/code.go +++ b/routers/web/explore/code.go @@ -34,12 +34,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 16da917d22..1b99f4183c 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 766dd5726a..16e620f57d 100644 --- a/routers/web/repo/search.go +++ b/routers/web/repo/search.go @@ -24,12 +24,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 == "" { @@ -54,7 +53,7 @@ func Search(ctx *context.Context) { ctx.Data["CodeIndexerUnavailable"] = !code_indexer.IsAvailable(ctx) } - ctx.Data["SourcePath"] = ctx.Repo.Repository.Link() + ctx.Data["Repo"] = ctx.Repo.Repository ctx.Data["SearchResults"] = searchResults ctx.Data["SearchResultLanguages"] = searchResultLanguages diff --git a/routers/web/user/code.go b/routers/web/user/code.go index 8613d38b65..92911edfe9 100644 --- a/routers/web/user/code.go +++ b/routers/web/user/code.go @@ -39,12 +39,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 @@
diff --git a/templates/repo/commits_search_dropdown.tmpl b/templates/repo/commits_search_dropdown.tmpl new file mode 100644 index 0000000000..5aa3f4f320 --- /dev/null +++ b/templates/repo/commits_search_dropdown.tmpl @@ -0,0 +1,8 @@ + diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 70f673e27e..221ee8d99b 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -8,27 +8,27 @@ {{ctx.Locale.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch}} {{end}}
-
- {{if .PageIsCommits}} -
- - -
- - -
- -
- {{else if .IsDiffCompare}} + {{if .IsDiffCompare}} +
{{if not .BaseIsCommit}}{{if .BaseIsBranch}}{{svg "octicon-git-branch"}}{{else if .BaseIsTag}}{{svg "octicon-tag"}}{{end}}{{.BaseBranch}}{{else}}{{ShortSha .BaseBranch}}{{end}} ... {{if not .HeadIsCommit}}{{if .HeadIsBranch}}{{svg "octicon-git-branch"}}{{else if .HeadIsTag}}{{svg "octicon-tag"}}{{end}}{{.HeadBranch}}{{else}}{{ShortSha .HeadBranch}}{{end}} - {{end}} -
+
+ {{end}} +{{if .PageIsCommits}} +
+
+
+ {{template "shared/search/input" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.commit_kind")}} + {{template "repo/commits_search_dropdown" .}} + {{template "shared/search/button" dict "Tooltip" (ctx.Locale.Tr "repo.commits.search.tooltip")}} +
+
+
+{{end}} + {{if and .Commits (gt .CommitCount 0)}} {{template "repo/commits_list" .}} {{end}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index a98dcb8c28..ef10904bcc 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -15,14 +15,12 @@