From d1bfc29f1b738b396e4fb9befa9b49c24f4e9249 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 19 Jul 2015 14:14:05 -0400 Subject: Add settings option to define the default task color --- app/Controller/Config.php | 1 + app/Controller/Task.php | 2 +- app/Locale/da_DK/translations.php | 1 + app/Locale/de_DE/translations.php | 1 + app/Locale/es_ES/translations.php | 1 + app/Locale/fi_FI/translations.php | 1 + app/Locale/fr_FR/translations.php | 1 + app/Locale/hu_HU/translations.php | 1 + app/Locale/it_IT/translations.php | 1 + app/Locale/ja_JP/translations.php | 1 + app/Locale/nl_NL/translations.php | 1 + app/Locale/pl_PL/translations.php | 1 + app/Locale/pt_BR/translations.php | 1 + app/Locale/ru_RU/translations.php | 1 + app/Locale/sr_Latn_RS/translations.php | 1 + app/Locale/sv_SE/translations.php | 1 + app/Locale/th_TH/translations.php | 1 + app/Locale/tr_TR/translations.php | 1 + app/Locale/zh_CN/translations.php | 1 + app/Model/Color.php | 2 +- app/Schema/Mysql.php | 7 ++++++- app/Schema/Postgres.php | 7 ++++++- app/Schema/Sqlite.php | 7 ++++++- app/Template/config/project.php | 3 +++ 24 files changed, 41 insertions(+), 5 deletions(-) (limited to 'app') 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 @@ form->csrf() ?> + form->label(t('Default task color'), 'default_color') ?> + form->select('default_color', $colors, $values, $errors) ?> + form->label(t('Default columns for new projects (Comma-separated)'), 'board_columns') ?> form->text('board_columns', $values, $errors) ?>

-- cgit v1.2.3