aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/index.js
diff options
context:
space:
mode:
authorRomain <romdum@users.noreply.github.com>2021-09-29 22:53:12 +0200
committerGitHub <noreply@github.com>2021-09-29 22:53:12 +0200
commitecfac78f6ef2cc01e4397c1a92b9a59b7ff0b2ff (patch)
tree161b9c6fcae7bbda0a827f565fdcc07cadd756ee /web_src/js/index.js
parentba1fdbcfdb26ce7088a7eab0175e224e5325ef72 (diff)
downloadgitea-ecfac78f6ef2cc01e4397c1a92b9a59b7ff0b2ff.tar.gz
gitea-ecfac78f6ef2cc01e4397c1a92b9a59b7ff0b2ff.zip
Kanban colored boards (#16647)
Add a column Color in ProjectBoard and color picker in new / edit project board form.
Diffstat (limited to 'web_src/js/index.js')
-rw-r--r--web_src/js/index.js21
1 files changed, 15 insertions, 6 deletions
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);