Expose tags to the user interface (first prototype)
This commit is contained in:
@@ -42,6 +42,24 @@ class TagModel extends Base
|
||||
return $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('name')->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get assignable tags for a project
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id
|
||||
* @return array
|
||||
*/
|
||||
public function getAssignableList($project_id)
|
||||
{
|
||||
return $this->db->hashtable(self::TABLE)
|
||||
->beginOr()
|
||||
->eq('project_id', $project_id)
|
||||
->eq('project_id', 0)
|
||||
->closeOr()
|
||||
->asc('name')
|
||||
->getAll('id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one tag
|
||||
*
|
||||
|
||||
@@ -22,11 +22,13 @@ class TaskCreationModel extends Base
|
||||
*/
|
||||
public function create(array $values)
|
||||
{
|
||||
if (! $this->projectModel->exists($values['project_id'])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$position = empty($values['position']) ? 0 : $values['position'];
|
||||
$tags = array();
|
||||
|
||||
if (isset($values['tags'])) {
|
||||
$tags = $values['tags'];
|
||||
unset($values['tags']);
|
||||
}
|
||||
|
||||
$this->prepare($values);
|
||||
$task_id = $this->db->table(TaskModel::TABLE)->persist($values);
|
||||
@@ -36,6 +38,10 @@ class TaskCreationModel extends Base
|
||||
$this->taskPositionModel->movePosition($values['project_id'], $task_id, $values['column_id'], $position, $values['swimlane_id'], false);
|
||||
}
|
||||
|
||||
if (! empty($tags)) {
|
||||
$this->taskTagModel->save($values['project_id'], $task_id, $tags);
|
||||
}
|
||||
|
||||
$this->fireEvents($task_id, $values);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,11 @@ class TaskModificationModel extends Base
|
||||
*/
|
||||
public function prepare(array &$values)
|
||||
{
|
||||
if (isset($values['tags'])) {
|
||||
$this->taskTagModel->save($values['project_id'], $values['id'], $values['tags']);
|
||||
unset($values['tags']);
|
||||
}
|
||||
|
||||
$values = $this->dateParser->convert($values, array('date_due'));
|
||||
$values = $this->dateParser->convert($values, array('date_started'), true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user