From ead1ca822649e354e9ca63e00615bb81b20c04d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rijaniaina=20Elie=20Fid=C3=A8le?= <elierijaniaina@gmail.com> Date: Wed, 26 Feb 2025 09:52:43 +0300 Subject: [PATCH] re: update link icon when contribute/quit --- assets/js/aap/aap.js | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/assets/js/aap/aap.js b/assets/js/aap/aap.js index 422e8de88..6f0e4844a 100755 --- a/assets/js/aap/aap.js +++ b/assets/js/aap/aap.js @@ -6103,6 +6103,7 @@ var aapObj = { }; if (wsCO && wsCO.id) post.emiter = wsCO.id; + const is_contributor = created.contributors.some(s => s.id === userId); coInterface.actions.request_create_action(post).then(function (response) { // send create notification var id_at_kanban = created.id; @@ -6128,9 +6129,9 @@ var aapObj = { badge: '0/0', className: 'kanban-no-task-action' }, { - icon: 'fa fa-link', + icon: `fa ${is_contributor ? "fa-unlink" : "fa-link"}`, bstooltip: { - text: coTranslate('Participate'), + text: is_contributor ? coTranslate("Quit") : coTranslate("Participate"), position: 'top' }, action: 'onParticipate' @@ -6206,7 +6207,9 @@ var aapObj = { text: trad.yes, btnClass: 'btn btn-warning', action: function () { - coInterface.actions.request_archive(action.id).then(); + coInterface.actions.request_archive(action.id).then(() => { + kanbanContainerDom.kanban("deleteData", action) + }); } } } @@ -6223,10 +6226,24 @@ var aapObj = { }, null, 'text'); }, onContributorRemove: arg => { + const was_contributor = arg.contributor.id === userId; + const data = $.extend({}, arg.card, {actions: arg.card.actions.map(m => { + if (m.action === "onParticipate") { + m.icon = `fa ${was_contributor ? "fa-link" : "fa-unlink"}`; + m.bstooltip.text = was_contributor ? coTranslate("Participate") : coTranslate("Quit"); + } + return m; + })}); + if (was_contributor) { + kanbanContainerDom.kanban("setData", { + id: arg.card.id, + data: data, + }) + } coInterface.actions.request_participation({ - action: arg.cardData.id, - contributors: arg.list.map(c => c.id), - }).then(r => toastr.success(JSON.stringify(r))); + action: arg.card.id, + contributors: arg.card.contributors.map(c => c.id), + }).then(r => toastr.success("La liste de contributeur a été mise à jour.")); } }); $(document.body).off('action.set-contributor').on('action.set-contributor', function (event, data) { -- GitLab