aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHester Gong <hestergong@gmail.com>2023-04-19 00:49:49 +0800
committerGitHub <noreply@github.com>2023-04-19 00:49:49 +0800
commit7ca7590c39dd63b2f812ce3a85ef82c2f4797aea (patch)
tree3c5ce8761528c7b70d4cdb7fd5e400d7fcc5bf0e
parent2002584986aa2e2cfdc66e2c4f85b5222c582e34 (diff)
downloadgitea-7ca7590c39dd63b2f812ce3a85ef82c2f4797aea.tar.gz
gitea-7ca7590c39dd63b2f812ce3a85ef82c2f4797aea.zip
Fix duplicate modals when clicking on "remove all" repository button (#24129)
Under Team tab of an organization, click on "remove all" repositories button will trigger two modals. Because `data-modal-id` is not proerly added. Before: https://user-images.githubusercontent.com/17645053/231988545-ac690b86-e3fe-4bf5-81c6-5ef09302e849.mov After: https://user-images.githubusercontent.com/17645053/231989678-53be4f91-fdc9-4bc5-ba11-a08aa4548e37.mov
-rw-r--r--templates/org/team/repositories.tmpl8
-rw-r--r--web_src/js/features/common-global.js8
2 files changed, 8 insertions, 8 deletions
diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl
index ac863f3a7b..0ffd50226f 100644
--- a/templates/org/team/repositories.tmpl
+++ b/templates/org/team/repositories.tmpl
@@ -25,8 +25,8 @@
</div>
<div class="inline ui field right">
<form class="ui form" id="repo-multiple-form" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/repositories" method="post">
- <button class="ui red button delete-button right" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/removeall">{{.locale.Tr "remove_all"}}</button>
- <button class="ui green button add-all-button right" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/addall">{{.locale.Tr "add_all"}}</button>
+ <button class="ui red button delete-button right" data-modal-id="org-team-remove-all-repo" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/removeall">{{.locale.Tr "remove_all"}}</button>
+ <button class="ui green button add-all-button right" data-modal-id="org-team-add-all-repo" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/addall">{{.locale.Tr "add_all"}}</button>
</form>
</div>
</div>
@@ -64,7 +64,7 @@
</div>
</div>
-<div class="ui small basic delete modal">
+<div class="ui small basic delete modal" id="org-team-remove-all-repo">
<div class="ui icon header">
{{svg "octicon-trash"}}
{{.locale.Tr "org.teams.remove_all_repos_title"}}
@@ -75,7 +75,7 @@
{{template "base/delete_modal_actions" .}}
</div>
-<div class="ui small basic addall modal">
+<div class="ui small basic addall modal" id="org-team-add-all-repo">
<div class="ui icon header">
{{svg "octicon-globe"}}
{{.locale.Tr "org.teams.add_all_repos_title"}}
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index 89e277ac84..0d80dc2091 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -194,8 +194,8 @@ export function initGlobalLinkActions() {
const $this = $(this);
const dataArray = $this.data();
let filter = '';
- if ($this.data('modal-id')) {
- filter += `#${$this.data('modal-id')}`;
+ if ($this.attr('data-modal-id')) {
+ filter += `#${$this.attr('data-modal-id')}`;
}
const dialog = $(`.delete.modal${filter}`);
@@ -237,8 +237,8 @@ export function initGlobalLinkActions() {
e.preventDefault();
const $this = $(this);
let filter = '';
- if ($this.attr('id')) {
- filter += `#${$this.attr('id')}`;
+ if ($this.attr('data-modal-id')) {
+ filter += `#${$this.attr('data-modal-id')}`;
}
const dialog = $(`.addall.modal${filter}`);