forgejo/templates
Yarden Shoham 6403d5fca7
Remove jQuery AJAX from the repo editor (#29636)
# Preview Tab
- Removed the jQuery AJAX call and replaced with our fetch wrapper
- Tested the preview tab functionality and it works as before

# Diff Tab
- Removed the jQuery AJAX call and replaced with htmx
- Tested the diff tab functionality and it works as before

## htmx Attributes
- `hx-post="{{.RepoLink}}..."`: make a POST request to the endpoint
- `hx-indicator=".tab[data-tab='diff']"`: attach the loading indicator
to the tab body
- `hx-target=".tab[data-tab='diff']"`: target the tab body for swapping
with the response
- `hx-swap="innerHTML"`: swap the target's inner HTML
- `hx-include="#edit_area"`: include the value of the textarea (content)
in the request body
- `hx-vals='{"context":"{{.BranchLink}}"}'`: include the context in the
request body
- `hx-params="context,content"`: include only these keys in the request
body

# Demo using `fetch` and `htmx` instead of jQuery AJAX

![demo](https://github.com/go-gitea/gitea/assets/20454870/585cd6e8-f329-4c9e-ab53-a540acbd7988)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit c1331d1f7ab60249ed2f080b24f3e32093fa708d)
2024-03-11 23:36:59 +07:00
..
admin templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
api/packages/pypi Remove incorrect HTML self close tag (#23748) 2023-03-27 18:05:51 +02:00
base Replace more gt- with tw-, update frontend docs (#29595) 2024-03-11 23:36:58 +07:00
code [PORT] Fix wrong line number in code search result (gitea#29260) (#2619) 2024-03-10 15:35:30 +00:00
custom [FEAT] Repository flags 2024-02-05 16:09:42 +01:00
devtest Use tailwind instead of gt-[wh]- helper classes (#29423) 2024-03-06 12:10:43 +08:00
explore Filter Repositories by type (#29231) 2024-03-06 12:10:46 +08:00
mail templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
org templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
package Fix incorrect package link method calls in templates (#29580) 2024-03-11 23:36:57 +07:00
projects Replace some gt- classes with tw- (#29570) 2024-03-11 23:36:57 +07:00
repo Remove jQuery AJAX from the repo editor (#29636) 2024-03-11 23:36:59 +07:00
shared [PORT] Fix wrong line number in code search result (gitea#29260) (#2619) 2024-03-10 15:35:30 +00:00
status templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
swagger Extend issue template yaml engine (#29274) 2024-03-06 12:10:47 +08:00
user Fix wrong header of org project view page (#29626) 2024-03-11 23:36:58 +07:00
webhook Change webhook-type in create-view (#29114) 2024-02-17 23:24:30 +01:00
home.tmpl templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
install.tmpl [I18N] Improve English names & consistency 2024-03-10 19:10:29 +05:00
post-install.tmpl [BRANDING] Custom loading animation for Forgejo 2024-02-05 16:02:13 +01:00