Allow to associate tags to colors

The color is then used as background in the board, list and task details
views
This commit is contained in:
Julian Maurice
2018-08-09 21:35:11 +02:00
parent ae3ade0908
commit 9d4cd31e1a
24 changed files with 69 additions and 27 deletions

View File

@@ -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.', .task-board-category.color-'.$color.', .table-list-category.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.', .task-tag.color-'.$color.' {';
$buffer .= 'background-color: '.$values['background'].';';
$buffer .= 'border-color: '.$values['border'];
$buffer .= '}';

View File

@@ -143,11 +143,12 @@ class TagModel extends Base
* @param string $tag
* @return bool|int
*/
public function create($project_id, $tag)
public function create($project_id, $tag, $color_id = null)
{
return $this->db->table(self::TABLE)->persist(array(
'project_id' => $project_id,
'name' => $tag,
'color_id' => $color_id,
));
}
@@ -159,10 +160,11 @@ class TagModel extends Base
* @param string $tag
* @return bool
*/
public function update($tag_id, $tag)
public function update($tag_id, $tag, $color_id)
{
return $this->db->table(self::TABLE)->eq('id', $tag_id)->update(array(
'name' => $tag,
'color_id' => $color_id,
));
}

View File

@@ -46,7 +46,7 @@ class TaskTagModel extends Base
public function getTagsByTask($task_id)
{
return $this->db->table(TagModel::TABLE)
->columns(TagModel::TABLE.'.id', TagModel::TABLE.'.name')
->columns(TagModel::TABLE.'.id', TagModel::TABLE.'.name', TagModel::TABLE.'.color_id')
->eq(self::TABLE.'.task_id', $task_id)
->join(self::TABLE, 'tag_id', 'id')
->findAll();
@@ -66,7 +66,7 @@ class TaskTagModel extends Base
}
$tags = $this->db->table(TagModel::TABLE)
->columns(TagModel::TABLE.'.id', TagModel::TABLE.'.name', self::TABLE.'.task_id')
->columns(TagModel::TABLE.'.id', TagModel::TABLE.'.name', TagModel::TABLE.'.color_id', self::TABLE.'.task_id')
->in(self::TABLE.'.task_id', $task_ids)
->join(self::TABLE, 'tag_id', 'id')
->asc(TagModel::TABLE.'.name')