mirror of https://github.com/go-gitea/gitea.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3e8414179c
- Closes https://github.com/go-gitea/gitea/issues/28880 This change introduces htmx with the hope we could use it to make Gitea more reactive while keeping our "HTML rendered on the server" approach. - Add `htmx.js` that imports `htmx.org` and initializes error toasts - Place `hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}'` on the `<body>` tag so every request that htmx sends is authenticated - Place `hx-swap="outerHTML"` on the `<body>` tag so the response of each htmx request replaces the tag it targets (as opposed to its inner content) - Place `hx-push-url="false"` on the `<body>` tag so no changes to the URL happen in `<form>` tags - Add the `is-loading` class during request ### Error toasts in action ![errors](https://github.com/go-gitea/gitea/assets/20454870/181a1beb-1cb8-4858-abe8-fa1fc3f5b8f3) ## Don't do a full page load when clicking the subscribe button - Refactor the form around the subscribe button into its own template - Use htmx to perform the form submission - `hx-boost="true"` to prevent the default form submission behavior of a full page load - `hx-sync="this:replace"` to replace the current request (in case the button is clicked again before the response is returned) - `hx-target="this"` to replace the form tag with the new form tag - Change the backend response to return a `<form>` tag instead of a redirect to the issue page ### Before ![subscribe_before](https://github.com/go-gitea/gitea/assets/20454870/cb2439a2-c3c0-425c-8d3c-5d646b1cdc28) ### After ![subscribe_after](https://github.com/go-gitea/gitea/assets/20454870/6fcd77d8-7b11-40b0-af4f-b152aaad787c) ## Don't do a full page load when clicking the follow button - Use htmx to perform the button request - `hx-post="{{.ContextUser.HomeLink}}?action=follow"` to send a POST request to follow the user - `hx-target="#profile-avatar-card"` to target the card div for replacement - `hx-indicator="#profile-avatar-card"` to place the loading indicator on the card - Change the backend response to return a `<div>` tag (the card) instead of a redirect to the user page ### Before ![follow_before](https://github.com/go-gitea/gitea/assets/20454870/a210b643-6e74-4ff9-8e61-d658c62edf1f) ### After ![follow_after](https://github.com/go-gitea/gitea/assets/20454870/5bb19ae9-0d59-4ae3-b538-4c83334e4722) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: 6543 <m.huber@kithara.com> Co-authored-by: Giteabot <teabot@gitea.io> |
1 year ago | |
---|---|---|
.. | ||
admin | 1 year ago | |
comp | 1 year ago | |
captcha.js | 2 years ago | |
citation.js | 1 year ago | |
clipboard.js | 1 year ago | |
codeeditor.js | 1 year ago | |
colorpicker.js | 2 years ago | |
common-global.js | 1 year ago | |
common-issue-list.js | 1 year ago | |
common-issue-list.test.js | 1 year ago | |
common-organization.js | 2 years ago | |
contextpopup.js | 2 years ago | |
copycontent.js | 1 year ago | |
dropzone.js | 2 years ago | |
emoji.js | 1 year ago | |
eventsource.sharedworker.js | 3 years ago | |
file-fold.js | 1 year ago | |
heatmap.js | 1 year ago | |
imagediff.js | 1 year ago | |
install.js | 1 year ago | |
notification.js | 2 years ago | |
org-team.js | 1 year ago | |
pull-view-file.js | 1 year ago | |
repo-branch.js | 2 years ago | |
repo-code.js | 2 years ago | |
repo-code.test.js | 1 year ago | |
repo-commit.js | 1 year ago | |
repo-common.js | 1 year ago | |
repo-diff-commit.js | 1 year ago | |
repo-diff-commitselect.js | 2 years ago | |
repo-diff-filetree.js | 2 years ago | |
repo-diff.js | 1 year ago | |
repo-editor.js | 1 year ago | |
repo-findfile.js | 1 year ago | |
repo-findfile.test.js | 1 year ago | |
repo-graph.js | 2 years ago | |
repo-home.js | 1 year ago | |
repo-issue-content.js | 1 year ago | |
repo-issue-list.js | 1 year ago | |
repo-issue-pr-form.js | 2 years ago | |
repo-issue-pr-status.js | 1 year ago | |
repo-issue.js | 1 year ago | |
repo-legacy.js | 1 year ago | |
repo-migrate.js | 1 year ago | |
repo-migration.js | 1 year ago | |
repo-projects.js | 1 year ago | |
repo-release.js | 2 years ago | |
repo-settings.js | 1 year ago | |
repo-template.js | 2 years ago | |
repo-unicode-escape.js | 2 years ago | |
repo-wiki.js | 2 years ago | |
sshkey-helper.js | ||
stopwatch.js | 2 years ago | |
tablesort.js | 2 years ago | |
tribute.js | 2 years ago | |
user-auth-webauthn.js | 1 year ago | |
user-auth.js | 2 years ago | |
user-settings.js | 2 years ago |