1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00
gitea/templates
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
..
admin Replace more gt- with tw-, update frontend docs (#29595) 2024-03-05 05:29:32 +00:00
api/packages/pypi
base Replace more gt- with tw-, update frontend docs (#29595) 2024-03-05 05:29:32 +00:00
code Fix wrong line number in code search result (#29260) 2024-03-06 07:24:43 +00:00
custom
devtest Use tailwind instead of gt-[wh]- helper classes (#29423) 2024-02-27 14:31:41 +00:00
explore Filter Repositories by type (#29231) 2024-03-03 10:18:34 +00:00
mail Remove unnecessary SanitizeHTML from code (#29575) 2024-03-04 12:02:45 +00:00
org Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
package Fix incorrect package link method calls in templates (#29580) 2024-03-04 10:57:30 +00:00
projects Replace some gt- classes with tw- (#29570) 2024-03-04 03:33:20 +00:00
repo Remove jQuery AJAX from the repo editor (#29636) 2024-03-07 07:28:33 +00:00
shared Fix wrong line number in code search result (#29260) 2024-03-06 07:24:43 +00:00
status Replace more gt- with tw-, update frontend docs (#29595) 2024-03-05 05:29:32 +00:00
swagger Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
user Move all login and account creation page labels to be above inputs (#29432) 2024-03-06 14:20:26 +00:00
webhook Change webhook-type in create-view (#29114) 2024-02-15 14:59:48 +01:00
home.tmpl Remove unnecessary "Str2html" modifier from templates (#29319) 2024-02-22 18:05:47 +00:00
install.tmpl Remove unnecessary "Safe" modifier from templates (#29318) 2024-02-22 17:02:33 +00:00
post-install.tmpl Always use ctx.Locale.Tr inside templates (#27231) 2023-09-25 08:56:50 +00:00