summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controller/CategoryController.php2
-rw-r--r--app/Model/ColorModel.php2
-rw-r--r--app/Model/TaskFinderModel.php1
-rw-r--r--app/Schema/Mysql.php7
-rw-r--r--app/Schema/Postgres.php7
-rw-r--r--app/Schema/Sql/mysql.sql1
-rw-r--r--app/Schema/Sql/postgres.sql3
-rw-r--r--app/Schema/Sqlite.php7
-rw-r--r--app/Template/board/task_footer.php2
-rw-r--r--app/Template/category/create.php3
-rw-r--r--app/Template/category/edit.php3
-rw-r--r--app/Template/task_list/task_details.php2
12 files changed, 33 insertions, 7 deletions
diff --git a/app/Controller/CategoryController.php b/app/Controller/CategoryController.php
index e3f2406b..c2b8c2a6 100644
--- a/app/Controller/CategoryController.php
+++ b/app/Controller/CategoryController.php
@@ -41,6 +41,7 @@ class CategoryController extends BaseController
$this->response->html($this->template->render('category/create', array(
'values' => $values + array('project_id' => $project['id']),
+ 'colors' => $this->colorModel->getList(),
'errors' => $errors,
'project' => $project,
)));
@@ -87,6 +88,7 @@ class CategoryController extends BaseController
$this->response->html($this->template->render('category/edit', array(
'values' => empty($values) ? $category : $values,
+ 'colors' => $this->colorModel->getList(),
'errors' => $errors,
'project' => $project,
)));
diff --git a/app/Model/ColorModel.php b/app/Model/ColorModel.php
index 7da05fcf..d0df2ed6 100644
--- a/app/Model/ColorModel.php
+++ b/app/Model/ColorModel.php
@@ -218,7 +218,7 @@ class ColorModel extends Base
$buffer = '';
foreach ($this->default_colors as $color => $values) {
- $buffer .= '.task-board.color-'.$color.', .task-summary-container.color-'.$color.', .color-picker-square.color-'.$color.' {';
+ $buffer .= '.task-board.color-'.$color.', .task-summary-container.color-'.$color.', .color-picker-square.color-'.$color.', .task-board-category.color-'.$color.', .table-list-category.color-'.$color.' {';
$buffer .= 'background-color: '.$values['background'].';';
$buffer .= 'border-color: '.$values['border'];
$buffer .= '}';
diff --git a/app/Model/TaskFinderModel.php b/app/Model/TaskFinderModel.php
index e3b5e0b9..0c96a821 100644
--- a/app/Model/TaskFinderModel.php
+++ b/app/Model/TaskFinderModel.php
@@ -123,6 +123,7 @@ class TaskFinderModel extends Base
UserModel::TABLE.'.avatar_path AS assignee_avatar_path',
CategoryModel::TABLE.'.name AS category_name',
CategoryModel::TABLE.'.description AS category_description',
+ CategoryModel::TABLE.'.color_id AS category_color_id',
ColumnModel::TABLE.'.title AS column_name',
ColumnModel::TABLE.'.position AS column_position',
SwimlaneModel::TABLE.'.name AS swimlane_name',
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index 7d8c0993..a5074a43 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -8,7 +8,12 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
-const VERSION = 131;
+const VERSION = 132;
+
+function version_132(PDO $pdo)
+{
+ $pdo->exec('ALTER TABLE `project_has_categories` ADD COLUMN `color_id` VARCHAR(50) DEFAULT NULL');
+}
function version_131(PDO $pdo)
{
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index bd2ba1e1..cd4e0fac 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -8,7 +8,12 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
-const VERSION = 109;
+const VERSION = 110;
+
+function version_110(PDO $pdo)
+{
+ $pdo->exec('ALTER TABLE "project_has_categories" ADD COLUMN "color_id" VARCHAR(50) DEFAULT NULL');
+}
function version_109(PDO $pdo)
{
diff --git a/app/Schema/Sql/mysql.sql b/app/Schema/Sql/mysql.sql
index fba959a9..b626013a 100644
--- a/app/Schema/Sql/mysql.sql
+++ b/app/Schema/Sql/mysql.sql
@@ -294,6 +294,7 @@ CREATE TABLE `project_has_categories` (
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`project_id` int(11) NOT NULL,
`description` mediumtext COLLATE utf8mb4_unicode_ci,
+ `color_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_project_category` (`project_id`,`name`),
KEY `categories_project_idx` (`project_id`),
diff --git a/app/Schema/Sql/postgres.sql b/app/Schema/Sql/postgres.sql
index 5a2224fb..c0ea275b 100644
--- a/app/Schema/Sql/postgres.sql
+++ b/app/Schema/Sql/postgres.sql
@@ -542,7 +542,8 @@ CREATE TABLE "project_has_categories" (
"id" integer NOT NULL,
"name" character varying(255) NOT NULL,
"project_id" integer NOT NULL,
- "description" "text"
+ "description" "text",
+ "color_id" character varying(255)
);
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index 99731452..7889b133 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -8,7 +8,12 @@ use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
use PDO;
-const VERSION = 118;
+const VERSION = 119;
+
+function version_119(PDO $pdo)
+{
+ $pdo->exec('ALTER TABLE project_has_categories ADD COLUMN color_id TEXT DEFAULT NULL');
+}
function version_118(PDO $pdo)
{
diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php
index 95ffd8fd..cdb75a1f 100644
--- a/app/Template/board/task_footer.php
+++ b/app/Template/board/task_footer.php
@@ -1,6 +1,6 @@
<?php if (! empty($task['category_id'])): ?>
<div class="task-board-category-container task-board-category-container-color">
- <span class="task-board-category category-<?= $this->text->e($task['category_name']) ?>">
+ <span class="task-board-category category-<?= $this->text->e($task['category_name']) ?> <?= $task['category_color_id'] ? "color-{$task['category_color_id']}" : '' ?>">
<?php if ($not_editable): ?>
<?= $this->text->e($task['category_name']) ?>
<?php else: ?>
diff --git a/app/Template/category/create.php b/app/Template/category/create.php
index f065305a..32501b8d 100644
--- a/app/Template/category/create.php
+++ b/app/Template/category/create.php
@@ -7,5 +7,8 @@
<?= $this->form->label(t('Category Name'), 'name') ?>
<?= $this->form->text('name', $values, $errors, array('autofocus', 'required')) ?>
+ <?= $this->form->label(t('Color'), 'color_id') ?>
+ <?= $this->form->select('color_id', array('' => t('No color')) + $colors, $values, $errors, array(), 'color-picker') ?>
+
<?= $this->modal->submitButtons() ?>
</form>
diff --git a/app/Template/category/edit.php b/app/Template/category/edit.php
index cd8ee7ba..446ce7b5 100644
--- a/app/Template/category/edit.php
+++ b/app/Template/category/edit.php
@@ -11,5 +11,8 @@
<?= $this->form->label(t('Description'), 'description') ?>
<?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
+ <?= $this->form->label(t('Color'), 'color_id') ?>
+ <?= $this->form->select('color_id', array('' => t('No color')) + $colors, $values, $errors, array(), 'color-picker') ?>
+
<?= $this->modal->submitButtons() ?>
</form>
diff --git a/app/Template/task_list/task_details.php b/app/Template/task_list/task_details.php
index b68be2dc..9afd9f55 100644
--- a/app/Template/task_list/task_details.php
+++ b/app/Template/task_list/task_details.php
@@ -4,7 +4,7 @@
<?= $this->text->e($task['column_name']) ?>
<?php if (! empty($task['category_id'])): ?>
- <span class="table-list-category">
+ <span class="table-list-category <?= $task['category_color_id'] ? "color-{$task['category_color_id']}" : '' ?>">
<?php if ($this->user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?>
<?= $this->url->link(
$this->text->e($task['category_name']),