mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Improve AJAX link and modal confirm dialog (#25210)
Clarify the "link-action" behavior: > // A "link-action" can post AJAX request to its "data-url" > // Then the browser is redirect to: the "redirect" in response, or "data-redirect" attribute, or current URL by reloading. And enhance the "link-action" to support showing a modal dialog for confirm. A similar general approach could also help PRs like https://github.com/go-gitea/gitea/pull/22344#discussion_r1062883436 > // If the "link-action" has "data-modal-confirm(-html)" attribute, a confirm modal dialog will be shown before taking action. And a lot of duplicate code can be removed now. A good framework design can help to avoid code copying&pasting. --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -32,11 +32,13 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
|
||||
mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}},
|
||||
{{/* this global i18n object should only contain general texts. for specialized texts, it should be provided inside the related modules by: (1) API response (2) HTML data-attribute (3) PageData */}}
|
||||
i18n: {
|
||||
copy_success: '{{.locale.Tr "copy_success"}}',
|
||||
copy_error: '{{.locale.Tr "copy_error"}}',
|
||||
error_occurred: '{{.locale.Tr "error.occurred"}}',
|
||||
network_error: '{{.locale.Tr "error.network_error"}}',
|
||||
remove_label_str: '{{.locale.Tr "remove_label_str"}}',
|
||||
copy_success: {{.locale.Tr "copy_success"}},
|
||||
copy_error: {{.locale.Tr "copy_error"}},
|
||||
error_occurred: {{.locale.Tr "error.occurred"}},
|
||||
network_error: {{.locale.Tr "error.network_error"}},
|
||||
remove_label_str: {{.locale.Tr "remove_label_str"}},
|
||||
modal_confirm: {{.locale.Tr "modal.confirm"}},
|
||||
modal_cancel: {{.locale.Tr "modal.cancel"}},
|
||||
},
|
||||
};
|
||||
{{/* in case some pages don't render the pageData, we make sure it is an object to prevent null access */}}
|
||||
|
Reference in New Issue
Block a user