Skip to content

Commit 95d4254

Browse files
committed
Update the number of cards in board while drop successful
1 parent bbcbbbe commit 95d4254

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

templates/repo/projects/view.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<div class="ui segment board-column" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}">
7676
<div class="board-column-header">
7777
<div class="ui large label board-label">
78-
<div class="ui small circular grey label">
78+
<div class="ui small circular grey label board-card-cnt">
7979
{{ len .Issues}}
8080
</div>
8181
{{.Title}}

web_src/js/features/projects.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ export default async function initProject() {
5050
},
5151
contentType: 'application/json',
5252
type: 'POST',
53+
success: () => {
54+
// Update the number of cards in board while drop successful.
55+
const fromCnt = e.from.parentElement.getElementsByClassName('board-card').length;
56+
e.from.parentElement.getElementsByClassName('board-card-cnt')[0].innerText = fromCnt;
57+
58+
const toCnt = e.to.parentElement.getElementsByClassName('board-card').length;
59+
e.to.parentElement.getElementsByClassName('board-card-cnt')[0].innerText = toCnt;
60+
},
5361
error: () => {
5462
e.from.insertBefore(e.item, e.from.children[e.oldIndex]);
5563
},

0 commit comments

Comments
 (0)