From 14f6fcf4481cedc2cd9d5ea5aaff88e109089e1f Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 20 Jan 2024 21:44:51 +0200 Subject: Don't do a full page load when clicking the subscribe button (#28871) - 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 - `hx-push-url="false"` to disable a change to the URL - `hx-swap="show:no-scroll"` to preserve the scroll position - Change the backend response to return a `
` tag instead of a redirect to the issue page - Include `htmx.org` in javascript imports 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. # Before ![before](https://github.com/go-gitea/gitea/assets/20454870/4ec3e81e-4dbf-4338-9968-b0655c276d4c) # After ![after](https://github.com/go-gitea/gitea/assets/20454870/8c8841af-9bfe-40b2-b1cd-cd1f3c90ba4d) --------- Signed-off-by: Yarden Shoham --- web_src/js/features/common-global.js | 1 + 1 file changed, 1 insertion(+) (limited to 'web_src') diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 0b00eb8e8e..ffa0434cff 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -12,6 +12,7 @@ import {showTemporaryTooltip} from '../modules/tippy.js'; import {confirmModal} from './comp/ConfirmModal.js'; import {showErrorToast} from '../modules/toast.js'; import {request, POST} from '../modules/fetch.js'; +import 'htmx.org'; const {appUrl, appSubUrl, csrfToken, i18n} = window.config; -- cgit v1.2.3