Découvrez les nouveautés de cette version : Fonctionnalités, améliorations et évolutions vous attendent ! 👉 Cliquez ici pour en savoir plus

Modifications pour le document KanbanBoardMacro

Modifié par Admin le 21/07/2025 - 09:07

Depuis la version 2.1
modifié par Admin
sur 02/04/2024 - 09:52
Commentaire de modification : Migrated property [type] from class [XWiki.WikiMacroParameterClass]
À la version 5.1
modifié par Admin
sur 08/11/2024 - 07:56
Commentaire de modification : Install extension [com.xwiki.task:application-task-ui/3.6.0]

Résumé

Détails

Propriétés de la Page
Contenu
... ... @@ -5,6 +5,9 @@
5 5  * ##user## [optional, default=$xcontext.userReference] define the user for who tasks are assigned
6 6  * ##space## [optional, default=TaskManager] define the space to look for tasks
7 7  * ##project## [optional, default=] define the project to look for tasks
8 +* ##colors## [optional, default=green,blue,orange] define the colors of the Kanban columns
9 +* ##columns## [optional, default=ToDo,InProgress,Done] define the statuses to display as Kanban columns
10 +* ##columnWidth## [optional, default=32%] define the width of all Kanban column
8 8  
9 9  Example:
10 10  
XWiki.WikiMacroClass[1]
Code de la macro
... ... @@ -1,7 +1,10 @@
1 1  {{velocity}}
2 +#set($discard = $xwiki.ssx.use('TaskManager.KanbanBoardMacro'))
2 2  ## The xwql variable is used by the awmkanban macro called from this one.
3 3  #set ($xwql = '')
4 4  #set($user = "$!{xcontext.macro.params.user}")
6 +#set ($columnWidth = "$!{xcontext.macro.params.columnWidth}")
7 +#set ($colors = "$!{xcontext.macro.params.colors}")
5 5  #if($user != '')
6 6   #set($xwql = "obj.assignee = '$escapetool.sql($user)'")
7 7  #end
... ... @@ -10,7 +10,7 @@
10 10   #if ($xwql.length() > 0)
11 11   #set ($xwql = "$xwql and")
12 12   #end
13 - #set($xwql = "${xwql} doc.space = '$escapetool.sql($space)'")
16 + #set($xwql = "${xwql} (doc.space like '$escapetool.sql($space).%' or doc.space = '$escapetool.sql($space)')")
14 14  #end
15 15  #set($project = "$!{xcontext.macro.params.project}")
16 16  #if($project != '')
... ... @@ -19,6 +19,15 @@
19 19   #end
20 20   #set($xwql = "$xwql obj.project = '$escapetool.sql($project)'")
21 21  #end
25 +#set ($columns = "$!{xcontext.macro.params.columns}")
26 +{{awmkanban
27 + className="TaskManager.TaskManagerClass"
28 + category="status"
29 + displayedCategoryColumns="$!escapetool.xml($columns)"
30 + title="name"
31 + columns="assignee,progress,duedate"
32 + width="$!escapetool.xml($columnWidth)"
33 + colors=$escapetool.xml($colors)
34 +/}}
22 22  {{/velocity}}
23 23  
24 -{{awmkanban className="TaskManager.TaskManagerClass" category="status" title="name" columns="assignee,progress,duedate" width="32%"/}}
Default categories
... ... @@ -1,0 +1,1 @@
1 +Content
XWiki.WikiMacroParameterClass[2]
Type du paramètre
... ... @@ -1,0 +1,1 @@
1 +org.xwiki.user.UserReference
XWiki.WikiMacroParameterClass[3]
Type du paramètre
... ... @@ -1,0 +1,1 @@
1 +com.xwiki.task.SpaceReference
XWiki.WikiMacroParameterClass[4]
Type du paramètre
... ... @@ -1,0 +1,1 @@
1 +com.xwiki.task.ProjectReference
XWiki.JavaScriptExtension[0]
Mode de mise en cache
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,49 @@
1 +require(['jquery'], function ($) {
2 +
3 + /**
4 + * Handles the fetching of the modal and the lazy loading of the css/js.
5 + */
6 + $(document).on('click', '.space-picker-kanban-parameter', function () {
7 + let URL = new XWiki.Document('SpacePicker', 'TaskManager').getURL('get');
8 + $.get(URL)
9 + .done(function (data) {
10 + $('body').append(`<div class='spacePickerKnbModal'> ${data} </div>`);
11 + $('.kanbanSpacePicker').modal('show');
12 + // Initialize UI elements that are lazy loaded.
13 + $(document).trigger('xwiki:dom:updated', { 'elements': $('.spacePickerKnbModal').toArray()});
14 + })
15 + .fail(function(){
16 + console.error('Failed to retrieve the space picker modal');
17 + });
18 + })
19 +
20 + $(document).on('show.bs.modal', '.kanbanSpacePicker', function () {
21 + $('.modal.macro-editor-modal.in').hide();
22 + })
23 +
24 + $(document).on('hidden.bs.modal', '.kanbanSpacePicker', function () {
25 + $('.modal.macro-editor-modal.in').show();
26 + // We remove the modal from the page
27 + $('.spacePickerKnbModal').remove();
28 + })
29 + /**
30 + * Handles the select button of the modal. If a space is selected it will return it's reference otherwise it will
31 + * return an empty string.
32 + */
33 + $(document).on('click', '.kanbanSpaceSelector', function () {
34 + // We remove the modal again
35 + selectedSpace = $('.xtree .jstree-clicked:last').attr('id');
36 + //Root element and we need to replace with an empty string so we can select all the tasks.
37 + if (selectedSpace === 'wiki:xwiki_anchor' || selectedSpace === 'document:xwiki:Main.WebHome_anchor') {
38 + selectedSpace = "";
39 + }
40 + else {
41 + selectedSpace = selectedSpace.replace('space:xwiki:', "").replace("_anchor", "");
42 +
43 + }
44 + $('.space-picker-kanban-parameter').val(selectedSpace);
45 + $('.kanbanSpacePicker').modal('hide');
46 + $('.modal.macro-editor-modal.in').show();
47 + })
48 +});
49 +
XWiki.WikiMacroParameterClass[6]
Valeur par défaut du paramètre
... ... @@ -1,0 +1,1 @@
1 +green,blue,orange
Paramètre obligatoire
... ... @@ -1,0 +1,1 @@
1 +Non
Nom du paramètre
... ... @@ -1,0 +1,1 @@
1 +colors
XWiki.WikiMacroParameterClass[7]
Valeur par défaut du paramètre
... ... @@ -1,0 +1,1 @@
1 +32%
Description du paramètre
... ... @@ -1,0 +1,1 @@
1 +The width of each Kanban column, specified in any css units (example: 32%, 500px, 30em, etc..).
Paramètre obligatoire
... ... @@ -1,0 +1,1 @@
1 +Non
Nom du paramètre
... ... @@ -1,0 +1,1 @@
1 +columnWidth