diff options
-rw-r--r-- | app/Controller/Task.php | 4 | ||||
-rw-r--r-- | app/Model/Swimlane.php | 34 | ||||
-rw-r--r-- | app/Template/task/new.php | 4 |
3 files changed, 30 insertions, 12 deletions
diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 1296204a..ace40a01 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -93,11 +93,12 @@ class Task extends Base { $project = $this->getProject(); $method = $this->request->isAjax() ? 'render' : 'layout'; + $swimlanes_list = $this->swimlane->getList($project['id']); if (empty($values)) { $values = array( - 'swimlane_id' => $this->request->getIntegerParam('swimlane_id'), + 'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)), 'column_id' => $this->request->getIntegerParam('column_id'), 'color_id' => $this->request->getStringParam('color_id'), 'owner_id' => $this->request->getIntegerParam('owner_id'), @@ -114,6 +115,7 @@ class Task extends Base 'users_list' => $this->projectPermission->getMemberList($project['id'], true, false, true), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), + 'swimlanes_list' => $swimlanes_list, 'date_format' => $this->config->get('application_date_format'), 'date_formats' => $this->dateParser->getAvailableFormats(), 'title' => $project['name'].' > '.t('New task') diff --git a/app/Model/Swimlane.php b/app/Model/Swimlane.php index 8f417fca..cf2103c2 100644 --- a/app/Model/Swimlane.php +++ b/app/Model/Swimlane.php @@ -99,10 +99,16 @@ class Swimlane extends Base */ public function getDefault($project_id) { - return $this->db->table(Project::TABLE) - ->eq('id', $project_id) - ->columns('id', 'default_swimlane', 'show_default_swimlane') - ->findOne(); + $result = $this->db->table(Project::TABLE) + ->eq('id', $project_id) + ->columns('id', 'default_swimlane', 'show_default_swimlane') + ->findOne(); + + if ($result['default_swimlane'] === 'Default swimlane') { + $result['default_swimlane'] = t($result['default_swimlane']); + } + + return $result; } /** @@ -166,6 +172,11 @@ class Swimlane extends Base ->findOneColumn('default_swimlane'); if ($default_swimlane) { + + if ($default_swimlane === 'Default swimlane') { + $default_swimlane = t($default_swimlane); + } + array_unshift($swimlanes, array('id' => 0, 'name' => $default_swimlane)); } @@ -183,14 +194,17 @@ class Swimlane extends Base public function getList($project_id, $prepend = false) { $swimlanes = array(); - $swimlanes[] = $this->db->table(Project::TABLE)->eq('id', $project_id)->findOneColumn('default_swimlane'); + $default = $this->db->table(Project::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane'); - $swimlanes = array_merge( - $swimlanes, - $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->orderBy('name', 'asc')->getAll('id', 'name') - ); + if ($prepend) { + $swimlanes[-1] = t('All swimlanes'); + } + + if (! empty($default)) { + $swimlanes[0] = $default === 'Default swimlane' ? t($default) : $default; + } - return $prepend ? array(-1 => t('All swimlanes')) + $swimlanes : $swimlanes; + return $swimlanes + $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->orderBy('position', 'asc')->getAll('id', 'name'); } /** diff --git a/app/Template/task/new.php b/app/Template/task/new.php index e64effde..4bfb8064 100644 --- a/app/Template/task/new.php +++ b/app/Template/task/new.php @@ -47,7 +47,6 @@ <div class="form-column"> <?= $this->formHidden('project_id', $values) ?> - <?= $this->formHidden('swimlane_id', $values) ?> <?= $this->formLabel(t('Assignee'), 'owner_id') ?> <?= $this->formSelect('owner_id', $users_list, $values, $errors) ?><br/> @@ -55,6 +54,9 @@ <?= $this->formLabel(t('Category'), 'category_id') ?> <?= $this->formSelect('category_id', $categories_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Swimlane'), 'swimlane_id') ?> + <?= $this->formSelect('swimlane_id', $swimlanes_list, $values, $errors) ?><br/> + <?= $this->formLabel(t('Column'), 'column_id') ?> <?= $this->formSelect('column_id', $columns_list, $values, $errors) ?><br/> |