blob: fc9839ac60c15cde8cc5e0ba7f6cbb3aeaaea783 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
Kanboard.Task = function(app) {
this.app = app;
};
// TODO: rewrite this code
Kanboard.Task.prototype.onPopoverOpened = function() {
var self = this;
self.renderColorPicker();
// Assign to me
$(document).on("click", ".assign-me", function(e) {
var currentId = $(this).data("current-id");
var dropdownId = "#modal-box #" + $(this).data("target-id");
e.preventDefault();
if ($(dropdownId + ' option[value=' + currentId + ']').length) {
$(dropdownId).val(currentId);
}
});
};
Kanboard.Task.prototype.renderColorPicker = function() {
function renderColorOption(color) {
return $(
'<div class="color-picker-option">' +
'<div class="color-picker-square color-' + color.id + '"></div>' +
'<div class="color-picker-label">' + color.text + '</div>' +
'</div>'
);
}
$(".color-picker").select2({
minimumResultsForSearch: Infinity,
templateResult: renderColorOption,
templateSelection: renderColorOption
});
};
|