mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-18 23:47:50 +00:00
feat: show spinner when loading content history menu (#9874)
- When clicking on the content history menu "edited" item, show a spinner animation as before the dropdown is show can take a measurable amount of time. - We cannot rely on fomantic adding the loading indicator (although it does have this capability), it only adds this indicator when waiting for the network request. For a fast Forgejo instance waiting for the network response is faster than what fomantic is doing to prepare the dropdown. - Resolves forgejo/forgejo#9841 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9874 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
346f87d7a2
commit
4cb72644d3
2 changed files with 82 additions and 25 deletions
|
|
@ -102,6 +102,15 @@ function showContentHistoryMenu(issueBaseUrl, $item, commentId) {
|
|||
|
||||
$headerLeft.find(`.content-history-menu`).remove();
|
||||
$headerLeft.append($(menuHtml));
|
||||
|
||||
// Should be run before fomantic's dropdown component.
|
||||
$headerLeft.find('.dropdown').on('click', function (ev) {
|
||||
if (ev.target !== this || this.classList.contains('active')) {
|
||||
return;
|
||||
}
|
||||
this.classList.add('is-loading');
|
||||
});
|
||||
|
||||
$headerLeft.find('.dropdown').dropdown({
|
||||
action: 'hide',
|
||||
apiSettings: {
|
||||
|
|
@ -117,6 +126,9 @@ function showContentHistoryMenu(issueBaseUrl, $item, commentId) {
|
|||
showContentHistoryDetail(issueBaseUrl, commentId, value, itemHtml);
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.classList.remove('is-loading');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue