gitea/templates/repo/editor
Yarden Shoham c1331d1f7a
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>
2024-03-07 07:28:33 +00:00
..
cherry_pick.tmpl Refactor Safe modifier (#29392) 2024-02-25 10:45:56 +00:00
commit_form.tmpl enforce maxlength in frontend (#29389) 2024-02-25 14:31:15 +00:00
delete.tmpl Add main landmark to templates and adjust titles (#22670) 2023-02-01 22:56:10 +00:00
diff_preview.tmpl Fix broken code editor diff preview (#23307) 2023-03-06 09:37:58 +08:00
edit.tmpl Remove jQuery AJAX from the repo editor (#29636) 2024-03-07 07:28:33 +00:00
patch.tmpl Fix incorrect tree path value for patch editor (#29377) 2024-02-26 09:05:22 +00:00
upload.tmpl enforce maxlength in frontend (#29389) 2024-02-25 14:31:15 +00:00