summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Controller/Config.php1
-rw-r--r--app/Controller/Task.php2
-rw-r--r--app/Locale/da_DK/translations.php1
-rw-r--r--app/Locale/de_DE/translations.php1
-rw-r--r--app/Locale/es_ES/translations.php1
-rw-r--r--app/Locale/fi_FI/translations.php1
-rw-r--r--app/Locale/fr_FR/translations.php1
-rw-r--r--app/Locale/hu_HU/translations.php1
-rw-r--r--app/Locale/it_IT/translations.php1
-rw-r--r--app/Locale/ja_JP/translations.php1
-rw-r--r--app/Locale/nl_NL/translations.php1
-rw-r--r--app/Locale/pl_PL/translations.php1
-rw-r--r--app/Locale/pt_BR/translations.php1
-rw-r--r--app/Locale/ru_RU/translations.php1
-rw-r--r--app/Locale/sr_Latn_RS/translations.php1
-rw-r--r--app/Locale/sv_SE/translations.php1
-rw-r--r--app/Locale/th_TH/translations.php1
-rw-r--r--app/Locale/tr_TR/translations.php1
-rw-r--r--app/Locale/zh_CN/translations.php1
-rw-r--r--app/Model/Color.php2
-rw-r--r--app/Schema/Mysql.php7
-rw-r--r--app/Schema/Postgres.php7
-rw-r--r--app/Schema/Sqlite.php7
-rw-r--r--app/Template/config/project.php3
-rw-r--r--tests/units/TaskCreationTest.php24
25 files changed, 65 insertions, 5 deletions
diff --git a/app/Controller/Config.php b/app/Controller/Config.php
index 1e6b3dc8..206237c0 100644
--- a/app/Controller/Config.php
+++ b/app/Controller/Config.php
@@ -104,6 +104,7 @@ class Config extends Base
$this->common('project');
$this->response->html($this->layout('config/project', array(
+ 'colors' => $this->color->getList(),
'default_columns' => implode(', ', $this->board->getDefaultColumns()),
'title' => t('Settings').' > '.t('Project settings'),
)));
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index db12a0c7..6e525b13 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -122,7 +122,7 @@ class Task extends Base
$values = array(
'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)),
'column_id' => $this->request->getIntegerParam('column_id'),
- 'color_id' => $this->request->getStringParam('color_id'),
+ 'color_id' => $this->request->getStringParam('color_id', $this->color->getDefaultColor()),
'owner_id' => $this->request->getIntegerParam('owner_id'),
'another_task' => $this->request->getIntegerParam('another_task'),
);
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index 5f55f3e8..a85ef96c 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 90c029ba..cb6cc8e3 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index 03661d75..2f5e9b9a 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index ddbb26c3..ab857645 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 1c4c76ee..db950a20 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -1000,4 +1000,5 @@ return array(
'Gitlab issue comment created' => 'Commentaire créé sur un ticket Gitlab',
'New remote user' => 'Créer un utilisateur distant',
'New local user' => 'Créer un utilisateur local',
+ 'Default task color' => 'Couleur par défaut des tâches',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index f1bd1453..ffc66324 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 6dd60c18..b232bdcb 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index e52f82b6..89d317ed 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index ed8be05b..bf43a9a7 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index 9f8641a0..6b4b411b 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 68de0368..ebe5466f 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 3b7d678c..75dd15c0 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index f3369341..706efbb0 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index db552359..a03aadfd 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index c4d608bd..8c24aa65 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index afb88744..e9fb19cd 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index cd2518fd..d1eec36f 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -998,4 +998,5 @@ return array(
// 'Gitlab issue comment created' => '',
// 'New remote user' => '',
// 'New local user' => '',
+ // 'Default task color' => '',
);
diff --git a/app/Model/Color.php b/app/Model/Color.php
index 1fd81b85..73e5d629 100644
--- a/app/Model/Color.php
+++ b/app/Model/Color.php
@@ -147,7 +147,7 @@ class Color extends Base
*/
public function getDefaultColor()
{
- return 'yellow'; // TODO: make this parameter configurable
+ return $this->config->get('default_color', 'yellow');
}
/**
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index 769a7425..c62f3a72 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -6,7 +6,12 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 79;
+const VERSION = 80;
+
+function version_80($pdo)
+{
+ $pdo->exec("INSERT INTO settings VALUES ('default_color', 'yellow')");
+}
function version_79($pdo)
{
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index fca87766..b436db1b 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -6,7 +6,12 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 59;
+const VERSION = 60;
+
+function version_60($pdo)
+{
+ $pdo->exec("INSERT INTO settings VALUES ('default_color', 'yellow')");
+}
function version_59($pdo)
{
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index 9981e72f..23097b55 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -6,7 +6,12 @@ use Core\Security;
use PDO;
use Model\Link;
-const VERSION = 75;
+const VERSION = 76;
+
+function version_76($pdo)
+{
+ $pdo->exec("INSERT INTO settings VALUES ('default_color', 'yellow')");
+}
function version_75($pdo)
{
diff --git a/app/Template/config/project.php b/app/Template/config/project.php
index 1ab69e26..b762de24 100644
--- a/app/Template/config/project.php
+++ b/app/Template/config/project.php
@@ -6,6 +6,9 @@
<?= $this->form->csrf() ?>
+ <?= $this->form->label(t('Default task color'), 'default_color') ?>
+ <?= $this->form->select('default_color', $colors, $values, $errors) ?>
+
<?= $this->form->label(t('Default columns for new projects (Comma-separated)'), 'board_columns') ?>
<?= $this->form->text('board_columns', $values, $errors) ?><br/>
<p class="form-help"><?= t('Default values are "%s"', $default_columns) ?></p>
diff --git a/tests/units/TaskCreationTest.php b/tests/units/TaskCreationTest.php
index 03a85b64..2dc67ad4 100644
--- a/tests/units/TaskCreationTest.php
+++ b/tests/units/TaskCreationTest.php
@@ -2,6 +2,7 @@
require_once __DIR__.'/Base.php';
+use Model\Config;
use Model\Task;
use Model\TaskCreation;
use Model\TaskFinder;
@@ -383,4 +384,27 @@ class TaskCreationTest extends Base
$this->assertNotFalse($task);
$this->assertEquals(3, $task['score']);
}
+
+ public function testDefaultColor()
+ {
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+ $tf = new TaskFinder($this->container);
+ $c = new Config($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test1')));
+
+ $task = $tf->getById(1);
+ $this->assertNotEmpty($task);
+ $this->assertEquals('yellow', $task['color_id']);
+
+ $this->assertTrue($c->save(array('default_color' => 'orange')));
+
+ $this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'test2')));
+
+ $task = $tf->getById(2);
+ $this->assertNotEmpty($task);
+ $this->assertEquals('orange', $task['color_id']);
+ }
}