Add settings option to define the default task color
This commit is contained in:
@@ -104,6 +104,7 @@ class Config extends Base
|
|||||||
$this->common('project');
|
$this->common('project');
|
||||||
|
|
||||||
$this->response->html($this->layout('config/project', array(
|
$this->response->html($this->layout('config/project', array(
|
||||||
|
'colors' => $this->color->getList(),
|
||||||
'default_columns' => implode(', ', $this->board->getDefaultColumns()),
|
'default_columns' => implode(', ', $this->board->getDefaultColumns()),
|
||||||
'title' => t('Settings').' > '.t('Project settings'),
|
'title' => t('Settings').' > '.t('Project settings'),
|
||||||
)));
|
)));
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class Task extends Base
|
|||||||
$values = array(
|
$values = array(
|
||||||
'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)),
|
'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)),
|
||||||
'column_id' => $this->request->getIntegerParam('column_id'),
|
'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'),
|
'owner_id' => $this->request->getIntegerParam('owner_id'),
|
||||||
'another_task' => $this->request->getIntegerParam('another_task'),
|
'another_task' => $this->request->getIntegerParam('another_task'),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1000,4 +1000,5 @@ return array(
|
|||||||
'Gitlab issue comment created' => 'Commentaire créé sur un ticket Gitlab',
|
'Gitlab issue comment created' => 'Commentaire créé sur un ticket Gitlab',
|
||||||
'New remote user' => 'Créer un utilisateur distant',
|
'New remote user' => 'Créer un utilisateur distant',
|
||||||
'New local user' => 'Créer un utilisateur local',
|
'New local user' => 'Créer un utilisateur local',
|
||||||
|
'Default task color' => 'Couleur par défaut des tâches',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -998,4 +998,5 @@ return array(
|
|||||||
// 'Gitlab issue comment created' => '',
|
// 'Gitlab issue comment created' => '',
|
||||||
// 'New remote user' => '',
|
// 'New remote user' => '',
|
||||||
// 'New local user' => '',
|
// 'New local user' => '',
|
||||||
|
// 'Default task color' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class Color extends Base
|
|||||||
*/
|
*/
|
||||||
public function getDefaultColor()
|
public function getDefaultColor()
|
||||||
{
|
{
|
||||||
return 'yellow'; // TODO: make this parameter configurable
|
return $this->config->get('default_color', 'yellow');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ use PDO;
|
|||||||
use Core\Security;
|
use Core\Security;
|
||||||
use Model\Link;
|
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)
|
function version_79($pdo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ use PDO;
|
|||||||
use Core\Security;
|
use Core\Security;
|
||||||
use Model\Link;
|
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)
|
function version_59($pdo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ use Core\Security;
|
|||||||
use PDO;
|
use PDO;
|
||||||
use Model\Link;
|
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)
|
function version_75($pdo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
<?= $this->form->csrf() ?>
|
<?= $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->label(t('Default columns for new projects (Comma-separated)'), 'board_columns') ?>
|
||||||
<?= $this->form->text('board_columns', $values, $errors) ?><br/>
|
<?= $this->form->text('board_columns', $values, $errors) ?><br/>
|
||||||
<p class="form-help"><?= t('Default values are "%s"', $default_columns) ?></p>
|
<p class="form-help"><?= t('Default values are "%s"', $default_columns) ?></p>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
require_once __DIR__.'/Base.php';
|
require_once __DIR__.'/Base.php';
|
||||||
|
|
||||||
|
use Model\Config;
|
||||||
use Model\Task;
|
use Model\Task;
|
||||||
use Model\TaskCreation;
|
use Model\TaskCreation;
|
||||||
use Model\TaskFinder;
|
use Model\TaskFinder;
|
||||||
@@ -383,4 +384,27 @@ class TaskCreationTest extends Base
|
|||||||
$this->assertNotFalse($task);
|
$this->assertNotFalse($task);
|
||||||
$this->assertEquals(3, $task['score']);
|
$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']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user