summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-04-19 23:28:28 +0900
committerGitHub <noreply@github.com>2023-04-19 10:28:28 -0400
commitf30cc9faa93935f5afb7a38354e5381d5e8825bf (patch)
tree532618f0a068343473e321eb782dc8c36c02ae39 /web_src
parente422342eebc18034ef586ec58f1e2fff0340091d (diff)
downloadgitea-f30cc9faa93935f5afb7a38354e5381d5e8825bf.tar.gz
gitea-f30cc9faa93935f5afb7a38354e5381d5e8825bf.zip
Add unset default project column (#23531)
Close: https://github.com/go-gitea/gitea/issues/23401
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/repo-projects.js33
1 files changed, 22 insertions, 11 deletions
diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js
index a1e177e461..a2679130d7 100644
--- a/web_src/js/features/repo-projects.js
+++ b/web_src/js/features/repo-projects.js
@@ -126,19 +126,30 @@ export function initRepoProject() {
});
});
- $(document).on('click', '.set-default-project-board', async function (e) {
- e.preventDefault();
+ $('.default-project-board-modal').each(function () {
+ const boardColumn = $(this).closest('.board-column');
+ const showButton = $(boardColumn).find('.default-project-board-show');
+ const commitButton = $(this).find('.default-project-board-button');
- await $.ajax({
- method: 'POST',
- url: $(this).data('url'),
- headers: {
- 'X-Csrf-Token': csrfToken,
- },
- contentType: 'application/json',
- });
+ if ($(showButton).data('type') === 'unset_default') {
+ $(commitButton).removeClass('primary');
+ $(commitButton).addClass('red');
+ }
- window.location.reload();
+ $(commitButton).on('click', (e) => {
+ e.preventDefault();
+
+ $.ajax({
+ method: 'POST',
+ url: $(showButton).data('url'),
+ headers: {
+ 'X-Csrf-Token': csrfToken,
+ },
+ contentType: 'application/json',
+ }).done(() => {
+ window.location.reload();
+ });
+ });
});
$('.delete-project-board').each(function () {