-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Remove jQuery AJAX from the repo editor #29636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove jQuery AJAX from the repo editor #29636
Conversation
# 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 targets 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 Signed-off-by: Yarden Shoham <[email protected]>
Can we maybe accept it as-is and handle style changes in a dedicated PR? |
Hmm there is at least one visual change in your PR, that tiny spinner on first diff preview wasn't there before. How is it triggered? |
htmx adds the Line 8 in f6d01ac
|
Ok, can we just remove the |
Removed loading and added an empty div with |
* giteaofficial/main: Remove jQuery AJAX from the repo editor (go-gitea#29636)
Preview Tab
Diff Tab
htmx Attributes
hx-post="{{.RepoLink}}..."
: make a POST request to the endpointhx-indicator=".tab[data-tab='diff']"
: attach the loading indicator to the tab bodyhx-target=".tab[data-tab='diff']"
: target the tab body for swapping with the responsehx-swap="innerHTML"
: swap the target's inner HTMLhx-include="#edit_area"
: include the value of the textarea (content) in the request bodyhx-vals='{"context":"{{.BranchLink}}"}'
: include the context in the request bodyhx-params="context,content"
: include only these keys in the request bodyDemo using
fetch
andhtmx
instead of jQuery AJAX