... |
... |
@@ -34,16 +34,16 @@ |
34 |
34 |
var posting = jQuery.post( updateService, { page : page, nb : counter, content : newBoards } ); |
35 |
35 |
posting.success(function(data) { |
36 |
36 |
if (data.indexOf("SUCCESS")>=0 && data.indexOf("SUCCESS")<10) { |
37 |
|
- #set($success = $escapetool.javascript($services.localization.render("kanban.update.success"))) |
|
37 |
+ #set($success = $escapetool.json($services.localization.render("kanban.update.success"))) |
38 |
38 |
new XWiki.widgets.Notification('$success', 'info', '20'); |
39 |
39 |
currentBoards = newBoards; |
40 |
40 |
} else { |
41 |
|
- #set($error = $escapetool.javascript($services.localization.render("kanban.update.error"))) |
|
41 |
+ #set($error = $escapetool.json($services.localization.render("kanban.update.error"))) |
42 |
42 |
new XWiki.widgets.Notification('$error', 'error', '20'); |
43 |
43 |
} |
44 |
44 |
}); |
45 |
45 |
posting.error(function(xhr,status,error) { |
46 |
|
- #set($error = $escapetool.javascript($services.localization.render("kanban.update.error"))) |
|
46 |
+ #set($error = $escapetool.json($services.localization.render("kanban.update.error"))) |
47 |
47 |
new XWiki.widgets.Notification('$error', 'error', '20'); |
48 |
48 |
}); |
49 |
49 |
|
... |
... |
@@ -110,6 +110,25 @@ |
110 |
110 |
}); |
111 |
111 |
|
112 |
112 |
}, |
|
113 |
+ colorClick: function (el, boardId) { |
|
114 |
+ console.log("in color click"); |
|
115 |
+ var board = jQuery(el.parentNode).attr("data-id"); |
|
116 |
+ var boardJSON = kanban.getBoardJSON(board); |
|
117 |
+ var currentColor = boardJSON.color; |
|
118 |
+ console.log("Current color " + currentColor); |
|
119 |
+ var index = kanban.options.colors.findIndex(function (element) { |
|
120 |
+ return (element == currentColor) |
|
121 |
+ }) + 1; |
|
122 |
+ console.log("Next index " + index); |
|
123 |
+ if (index >= kanban.options.colors.length) |
|
124 |
+ index = 0; |
|
125 |
+ var nextColor = kanban.options.colors[index]; |
|
126 |
+ console.log("Next color " + nextColor); |
|
127 |
+ boardJSON.color = nextColor; |
|
128 |
+ jQuery(el).removeClass("kanban-header-" + currentColor); |
|
129 |
+ jQuery(el).addClass("kanban-header-" + nextColor); |
|
130 |
+ kanban.onChange(); |
|
131 |
+ }, |
113 |
113 |
removeClick: function (el, boardId) { |
114 |
114 |
if (confirm("Do you want to delete this board?")) { |
115 |
115 |
console.log("Delete board"); |
... |
... |
@@ -154,37 +154,12 @@ |
154 |
154 |
+ boardId + '</value></property>' |
155 |
155 |
jQuery.ajax({ url: restURL, type: 'PUT', data: data, contentType: "application/xml", |
156 |
156 |
success: function(result) { |
157 |
|
- #set($success = $escapetool.javascript($services.localization.render("kanban.update.success"))) |
|
176 |
+ #set($success = $escapetool.json($services.localization.render("kanban.update.success"))) |
158 |
158 |
new XWiki.widgets.Notification('$success', 'info', '20'); |
159 |
159 |
}, |
160 |
160 |
error: function(result) { |
161 |
|
- // This is a workaround for XWIKI-20704. Remove this section of code when the parent |
162 |
|
- // of this project will greater or equal than the fix version of the issue. |
163 |
|
- // --- START --- |
164 |
|
- let regex = /\/objects\/([^\/]+)\/0\/properties\/([^\/]+)/; |
165 |
|
- let match = restURL.match(regex); |
166 |
|
- let params = { |
167 |
|
- outputSyntax: 'plain', |
168 |
|
- docRef: currentdoc.documentReference.toString(), |
169 |
|
- className: match[1], |
170 |
|
- propertyName: match[2] |
171 |
|
- }; |
172 |
|
- jQuery.ajax({ |
173 |
|
- url: new XWiki.Document(XWiki.Model.resolve('Macros.KanbanWorkaroundService', XWiki.EntityType.DOCUMENT, XWiki.currentDocument.getDocumentReference())).getURL('get', jQuery.param(params)), |
174 |
|
- type: 'GET', |
175 |
|
- success: function(result) { |
176 |
|
- if (result.status === boardId) { |
177 |
|
- new XWiki.widgets.Notification('$success', 'info', '20'); |
178 |
|
- } else { |
179 |
|
- #set($error = $escapetool.javascript($services.localization.render("kanban.update.error"))) |
180 |
|
- new XWiki.widgets.Notification('$error', 'error', '20'); |
181 |
|
- } |
182 |
|
- }, |
183 |
|
- error: function() { |
184 |
|
- new XWiki.widgets.Notification('$error', 'error', '20'); |
185 |
|
- } |
186 |
|
- }); |
187 |
|
- // --- END --- |
|
180 |
+ #set($error = $escapetool.json($services.localization.render("kanban.update.error"))) |
|
181 |
+ new XWiki.widgets.Notification('$error', 'error', '20'); |
188 |
188 |
} |
189 |
189 |
}); |
190 |
190 |
}, |
... |
... |
@@ -216,7 +216,7 @@ |
216 |
216 |
initKanban(data, updateService); |
217 |
217 |
}); |
218 |
218 |
getdata.error(function(xhr,status,error) { |
219 |
|
- #set($error = $escapetool.javascript($services.localization.render("kanban.load.error"))) |
|
213 |
+ #set($error = $escapetool.json($services.localization.render("kanban.load.error"))) |
220 |
220 |
new XWiki.widgets.Notification('$error', 'error', '20'); |
221 |
221 |
}); |
222 |
222 |
#elseif($xcontext.macro.content) |