forgejo/templates/repo
Yarden Shoham 1e29bccddb
Fix elipsis button not working if the last commit loading is deferred (#29544)
Before this change, if we had more than 200 entries being deferred in
loading, the entire table would get replaced thus losing any event
listeners attached to the elements within the table, such as the elipsis
button and commit list with tippy.

With this change we remove the previous javascript code that replaced
the table and use htmx to replace the table.

htmx attributes added:
- `hx-indicator="tr.notready td.message span"`: attach the loading
spinner to the files whose last commit is still being loaded
- `hx-trigger="load"` trigger the request-replace behavior as soon as
possible
- `hx-swap="morph"`: use the idiomorph morphing algorithm, this is the
thing that makes it so the elipsis button event listener is kept during
the replacement, fixing the bug because we don't actually replace the
table, only modifying it
- `hx-post="{{.LastCommitLoaderURL}}"`: make a post request to this url
to get the table with all of the commit information

As part of this change I removed the handling of partial replacement in
the case we have less than 200 "not ready" files. The first reason is
that I couldn't make htmx replace only a subset of returned elements,
the second reason is that we have a cache implemented in the backend
already so the only cost added is that we query the cache a few times
(which is sure to be populated due to the initial request), and the last
reason is that since the last refactor of this functionality that
removed jQuery we don't properly send the "not ready" entries as the
backend expects `FormData` with `f[]` and we send a JSON with `f` so we
always query for all rows anyway.

# Before

![before](https://github.com/go-gitea/gitea/assets/20454870/482ebfec-66c5-40cc-9c1e-e3b3bfe1bbc1)

# After

![after](https://github.com/go-gitea/gitea/assets/20454870/454c517e-3a4e-4006-a49f-99cc56e0fd60)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 937e8b55149388840bbf6c4d7216495bc3dd2fe9)
2024-03-06 12:10:46 +08: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 Rename Str2html to SanitizeHTML and clarify its behavior (followup) 2024-03-06 12:10:45 +08:00
cite
code Remove incorrect and unnecessary Escape from templates (#29394) 2024-02-26 22:30:27 +01:00
diff Fix incorrect redirection when creating a PR fails (#29537) 2024-03-06 12:10:45 +08:00
editor enforce maxlength in frontend (#29389) 2024-02-26 22:30:27 +01:00
find
graph
issue Fix incorrect redirection when creating a PR fails (#29537) 2024-03-06 12:10:45 +08:00
migrate Rename Str2html to SanitizeHTML and clarify its behavior (followup) 2024-03-06 12:10:45 +08:00
projects
pulls Remove unnecessary "Safe" modifier from templates (#29318) 2024-02-26 22:30:26 +01:00
release Rename Str2html to SanitizeHTML and clarify its behavior (followup) 2024-03-06 12:10:45 +08:00
settings Rename Str2html to SanitizeHTML and clarify its behavior (followup) 2024-03-06 12:10:45 +08:00
tag
wiki Remove incorrect and unnecessary Escape from templates (#29394) 2024-02-26 22:30:27 +01:00
activity.tmpl Implement recent commits graph (#29210) 2024-02-26 22:30:26 +01:00
admin_flags.tmpl
blame.tmpl Rename Str2html to SanitizeHTML and clarify its behavior (followup) 2024-03-06 12:10:45 +08:00
branch_dropdown.tmpl [gitea] Rework spellchecking, add lint-spell (#29106) 2024-02-10 10:53:43 +01:00
clone_buttons.tmpl Fix more "locale" usages (#27259) 2023-09-25 20:42:40 +08:00
clone_script.tmpl Fix URL calculation in clone input box (#29470) 2024-03-06 12:10:44 +08:00
code_frequency.tmpl Implement code frequency graph (#29191) 2024-02-26 22:30:26 +01:00
commit_load_branches_and_tags.tmpl
commit_page.tmpl Rename Str2html to SanitizeHTML and clarify its behavior (#29516) 2024-03-06 12:10:45 +08:00
commit_status.tmpl
commit_statuses.tmpl Show commit status for releases (#29149) 2024-02-19 22:58:33 +01:00
commits.tmpl
commits_list.tmpl Show View at this point in history for every commit (#29122) 2024-02-14 21:44:24 +01:00
commits_list_small.tmpl
commits_table.tmpl
contributors.tmpl Deduplicate translations for contributors graph (#29256) 2024-02-19 22:58:33 +01:00
create.tmpl Rename Str2html to SanitizeHTML and clarify its behavior (followup) 2024-03-06 12:10:45 +08:00
create_helper.tmpl Remove incorrect and unnecessary Escape from templates (#29394) 2024-02-26 22:30:27 +01:00
empty.tmpl Rename Str2html to SanitizeHTML and clarify its behavior (followup) 2024-03-06 12:10:45 +08: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 Fix the Fork button in repo headers 2024-02-27 18:36:37 +00:00
home.tmpl Remove unnecessary "Safe" modifier from templates (#29318) 2024-02-26 22:30:26 +01:00
icon.tmpl Tweak repo header (#29134) 2024-02-17 23:24:30 +01:00
latest_commit.tmpl
navbar.tmpl Implement recent commits graph (#29210) 2024-02-26 22:30:26 +01:00
packages.tmpl
pulse.tmpl Remove unnecessary "Safe" modifier from templates (#29318) 2024-02-26 22:30:26 +01:00
recent_commits.tmpl Implement recent commits graph (#29210) 2024-02-26 22:30:26 +01:00
release_tag_header.tmpl Apply compact padding to small buttons with svg icons (#29471) 2024-03-06 12:10:44 +08:00
search.tmpl Remove incorrect and unnecessary Escape from templates (#29394) 2024-02-26 22:30:27 +01:00
search_name.tmpl
shabox_badge.tmpl
star_unstar.tmpl
sub_menu.tmpl
unicode_escape_prompt.tmpl Rename Str2html to SanitizeHTML and clarify its behavior (followup) 2024-03-06 12:10:45 +08:00
upload.tmpl
user_cards.tmpl Remove unnecessary "Safe" modifier from templates (#29318) 2024-02-26 22:30:26 +01:00
view_file.tmpl [FEAT] Show follow symlink button 2024-03-02 17:58:09 +01: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