Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code search input for different views #30678

Merged
merged 4 commits into from
Apr 26, 2024

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Apr 24, 2024

Now only show the "code search" on the repo home page, because it only does global search.
So do not show it when viewing file or directory to avoid misleading users (it doesn't search in a directory)

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 24, 2024
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 24, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files labels Apr 24, 2024
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Apr 24, 2024

When debugging, I also removed the unused IsRepoToolbarCommits by the way, and add some comments.

Screentshots:

image

image

image

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 24, 2024
@@ -136,7 +138,7 @@
</div>
{{template "repo/cite/cite_modal" .}}
{{end}}
{{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}
{{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home) */}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a variable for IsViewDirectory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so, as this is a quick bug fix, do not want to introduce any potential regression.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we need to remember adding (not .IsXXX) here when adding a new page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to rewrite the page at that time, instead of introducing more if tricks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. So can you add TODO or FIXME here, for avoiding forgetting this.

Copy link
Contributor Author

@wxiaoguang wxiaoguang Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home) */}}
{{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to commit the suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really ? I do not think I forgot. Why I have to keep explaining everything .........

image

Copy link
Member

@silverwind silverwind Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok, I missed b3829ad. GitHub wasn't showing it in the commit list for some reason.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 26, 2024
@wxiaoguang wxiaoguang enabled auto-merge (squash) April 26, 2024 10:54
@wxiaoguang wxiaoguang merged commit 993736d into go-gitea:main Apr 26, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Apr 26, 2024
@wxiaoguang wxiaoguang deleted the fix-repo-search branch April 26, 2024 11:41
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 26, 2024
* giteaofficial/main:
  feat(api): enhance Actions Secrets Management API for repository (go-gitea#30656)
  Fix code search input for different views (go-gitea#30678)
  Fix incorrect object id hash function (go-gitea#30708)
  Add route handler info for debugging purpose (go-gitea#30705)
  Bump htmx version to 1.9.12 (go-gitea#30711)
@wxiaoguang wxiaoguang added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Apr 27, 2024
@wxiaoguang wxiaoguang modified the milestones: 1.23.0, 1.22.0 Apr 27, 2024
silverwind added a commit to silverwind/gitea that referenced this pull request Apr 27, 2024
* origin/main:
  Replace deprecated `math/rand` functions (go-gitea#30733)
  Make Ctrl+Enter work for issue/comment edit (go-gitea#30720)
  Rename migration package name for 1.22-rc1 (go-gitea#30730)
  Issue card improvements (go-gitea#30687)
  Don't show loading indicators when refreshing the system status (go-gitea#30712)
  Add some tests to clarify the "must-change-password" behavior (go-gitea#30693)
  Prevent allow/reject reviews on merged/closed PRs (go-gitea#30686)
  Update JS dependencies (go-gitea#30713)
  Improve diff stats bar (go-gitea#30669)
  Remove unused parameter for some functions in `services/mirror` (go-gitea#30724)
  Update misspell to 0.5.1 and add `misspellings.csv` (go-gitea#30573)
  Suppress browserslist warning in webpack target (go-gitea#30571)
  [skip ci] Updated translations via Crowdin
  Diff color enhancements, add line number background (go-gitea#30670)
  feat(api): enhance Actions Secrets Management API for repository (go-gitea#30656)
  Fix code search input for different views (go-gitea#30678)
  Fix incorrect object id hash function (go-gitea#30708)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files size/S Denotes a PR that changes 10-29 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants