Remove jQuery from the code diff expansion buttons (#29385)
- Removed all jQuery AJAX calls and replaced with htmx
- Tested the code diff expansion buttons functionality and it works as
before plus a loading indicator
# Demo using `htmx` instead of jQuery AJAX

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 4e3d81e44ee3f504f7262966533305561e04101f)
This commit is contained in:
parent
4a08726c96
commit
30fe3d8d4c
4 changed files with 12 additions and 20 deletions
|
@ -186,14 +186,6 @@ export function initRepoCodeView() {
|
|||
$(document).on('click', '.fold-file', ({currentTarget}) => {
|
||||
invertFileFolding(currentTarget.closest('.file-content'), currentTarget);
|
||||
});
|
||||
$(document).on('click', '.code-expander-button', async ({currentTarget}) => {
|
||||
const url = currentTarget.getAttribute('data-url');
|
||||
const query = currentTarget.getAttribute('data-query');
|
||||
const anchor = currentTarget.getAttribute('data-anchor');
|
||||
if (!url) return;
|
||||
const blob = await $.get(`${url}?${query}&anchor=${anchor}`);
|
||||
currentTarget.closest('tr').outerHTML = blob;
|
||||
});
|
||||
$(document).on('click', '.copy-line-permalink', async ({currentTarget}) => {
|
||||
await clippie(toAbsoluteUrl(currentTarget.getAttribute('data-url')));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue