Use the same task form layout everywhere

This commit is contained in:
Frederic Guillot
2016-06-24 17:57:26 -04:00
parent 18cb7ad0a4
commit 17213da5ce
18 changed files with 196 additions and 164 deletions

View File

@@ -33,12 +33,7 @@ Kanboard.Task.prototype.onPopoverOpened = function() {
var self = this;
var reloadingProjectId = 0;
// Change color
$(document).on("click", ".color-square", function() {
$(".color-square-selected").removeClass("color-square-selected");
$(this).addClass("color-square-selected");
$("#form-color_id").val($(this).data("color-id"));
});
self.renderColorPicker();
// Assign to me
$(document).on("click", ".assign-me", function(e) {
@@ -75,3 +70,20 @@ Kanboard.Task.prototype.onPopoverOpened = function() {
}
});
};
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
});
};