0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-02-18 20:06:20 -05:00
forgejo/templates/repo
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
..
actions Merge pull request '[UI] Actions: Link to Workflow in View' (#1866) from n0toose/forgejo:forgejo-add-workflow-link into forgejo 2024-02-28 17:28:16 +00:00
branch templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
cite
code
diff templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
editor Remove jQuery AJAX from the repo editor (#29636) 2024-03-11 23:36:59 +07:00
find
graph
issue templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
migrate templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
projects
pulls
release templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
settings templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
tag
wiki Replace some gt- classes with tw- (#29570) 2024-03-11 23:36:57 +07:00
activity.tmpl
admin_flags.tmpl
blame.tmpl templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
branch_dropdown.tmpl
clone_buttons.tmpl
clone_script.tmpl Fix URL calculation in clone input box (#29470) 2024-03-06 12:10:44 +08:00
code_frequency.tmpl
commit_load_branches_and_tags.tmpl
commit_page.tmpl Replace more gt- with tw-, update frontend docs (#29595) 2024-03-11 23:36:58 +07:00
commit_status.tmpl
commit_statuses.tmpl
commits.tmpl
commits_list.tmpl
commits_list_small.tmpl Replace some gt- classes with tw- (#29570) 2024-03-11 23:36:57 +07:00
commits_table.tmpl Replace some gt- classes with tw- (#29570) 2024-03-11 23:36:57 +07:00
contributors.tmpl
create.tmpl templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
create_helper.tmpl
empty.tmpl templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
file_info.tmpl
flags.tmpl
forks.tmpl
graph.tmpl
header.tmpl Make settings tab not active when on repository units tab 2024-02-28 21:17:53 -06:00
header_fork.tmpl Replace some gt- classes with tw- (#29570) 2024-03-11 23:36:57 +07:00
home.tmpl Replace some gt- classes with tw- (#29570) 2024-03-11 23:36:57 +07:00
icon.tmpl
latest_commit.tmpl
navbar.tmpl
packages.tmpl
pulse.tmpl
recent_commits.tmpl
release_tag_header.tmpl Apply compact padding to small buttons with svg icons (#29471) 2024-03-06 12:10:44 +08:00
search.tmpl [PORT] Fix wrong line number in code search result (gitea#29260) (#2619) 2024-03-10 15:35:30 +00:00
search_name.tmpl
shabox_badge.tmpl
star_unstar.tmpl
sub_menu.tmpl
unicode_escape_prompt.tmpl templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
upload.tmpl
user_cards.tmpl
view_file.tmpl Replace some gt- classes with tw- (#29570) 2024-03-11 23:36:57 +07:00
view_list.tmpl Fix elipsis button not working if the last commit loading is deferred (#29544) 2024-03-06 12:10:46 +08:00
watch_unwatch.tmpl
watchers.tmpl