From ecfac78f6ef2cc01e4397c1a92b9a59b7ff0b2ff Mon Sep 17 00:00:00 2001 From: Romain Date: Wed, 29 Sep 2021 22:53:12 +0200 Subject: Kanban colored boards (#16647) Add a column Color in ProjectBoard and color picker in new / edit project board form. --- web_src/js/index.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'web_src/js/index.js') diff --git a/web_src/js/index.js b/web_src/js/index.js index a092452e6b..5c1510fb89 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -159,13 +159,8 @@ function initLabelEdit() { $newLabelPanel.hide(); }); - createColorPicker($('.color-picker')); + initColorPicker(); - $('.precolors .color').on('click', function () { - const color_hex = $(this).data('color-hex'); - $('.color-picker').val(color_hex); - $('.minicolors-swatch-color').css('background-color', color_hex); - }); $('.edit-label-button').on('click', function () { $('.edit-label .color-picker').minicolors('value', $(this).data('color')); $('#label-modal-id').val($(this).data('id')); @@ -182,6 +177,16 @@ function initLabelEdit() { }); } +function initColorPicker() { + createColorPicker($('.color-picker')); + + $('.precolors .color').on('click', function () { + const color_hex = $(this).data('color-hex'); + $('.color-picker').val(color_hex); + $('.minicolors-swatch-color').css('background-color', color_hex); + }); +} + function updateIssuesMeta(url, action, issueIds, elementId) { return new Promise(((resolve) => { $.ajax({ @@ -2753,6 +2758,10 @@ $(document).ready(async () => { }); $('.show-modal.button').on('click', function () { $($(this).data('modal')).modal('show'); + const colorPickers = $($(this).data('modal')).find('.color-picker'); + if (colorPickers.length > 0) { + initColorPicker(); + } }); $('.delete-post.button').on('click', function () { const $this = $(this); -- cgit v1.2.3