Commit f283de77 authored by Remi Rampin's avatar Remi Rampin

Consume tag_count_changes in JavaScript

parent aaa5d7eb
Pipeline #66391311 passed with stage
in 2 minutes and 15 seconds
......@@ -704,7 +704,7 @@ function updateTagsList() {
' <a id="tag-link-' + tag.id + '">' + escapeHtml(tag.path) + '</a>' +
' </div>' +
' <div>' +
' <span href="#" class="badge badge-secondary badge-pill">' + tag.count + '</span>' +
' <span href="#" class="badge badge-secondary badge-pill" id="tag-' + tag.id + '-count">' + tag.count + '</span>' +
' <a href="javascript:editTag(' + tag.id + ');" class="badge badge-primary badge-pill">' + gettext("edit") + '</a>' +
' </div>' +
'</div>' +
......@@ -762,6 +762,13 @@ function updateTagsList() {
updateTagsList();
function updateTagCount(id, delta) {
var elem = document.getElementById('tag-' + id + '-count');
var value = parseInt(elem.textContent);
value += delta;
elem.textContent = value;
}
var tag_add_modal = document.getElementById('tag-add-modal');
function createTag() {
......@@ -1506,6 +1513,12 @@ function longPollForEvents() {
removeMember(result.member_remove[i]);
}
}
if('tag_count_changes' in result) {
var entries = Object.entries(result.tag_count_changes);
for(var i = 0; i < entries.length; ++i) {
updateTagCount(entries[i][0], entries[i][1]);
}
}
last_event = result.id;
// Re-open connection
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment