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

Don't do a full page load when searching code #29138

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

zokkis
Copy link
Contributor

@zokkis zokkis commented Feb 11, 2024

Don't do a full page load when searching code and fold the result


  • maybe the idea to send depending on the htmx-header the full-content or only the searchresults needs to be discussed

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 11, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 11, 2024
$(document).on('click', '.fold-container .fold-button', ({currentTarget}) => {
invertFileFolding(currentTarget.closest('.fold-container'), currentTarget);
});
}
Copy link
Member

@silverwind silverwind Feb 13, 2024

Choose a reason for hiding this comment

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

Can we use a <details> element for the toggle mechanism instead of this JS? I know it can be (ab)used for a lot of use cases, so I think it's suitable.

@@ -42,8 +43,15 @@ func Code(ctx *context.Context) {
ctx.Data["queryType"] = queryType
ctx.Data["PageIsViewCode"] = true

isHtmxRequest := len(ctx.Req.Header.Values("HX-Request")) > 0
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
isHtmxRequest := len(ctx.Req.Header.Values("HX-Request")) > 0
isHtmxRequest := ctx.Req.Header.Get("HX-Request") == "true"

@zokkis zokkis marked this pull request as draft February 15, 2024 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants