Add swimlane dropdown in task creation form
This commit is contained in:
@@ -93,11 +93,12 @@ class Task extends Base
|
|||||||
{
|
{
|
||||||
$project = $this->getProject();
|
$project = $this->getProject();
|
||||||
$method = $this->request->isAjax() ? 'render' : 'layout';
|
$method = $this->request->isAjax() ? 'render' : 'layout';
|
||||||
|
$swimlanes_list = $this->swimlane->getList($project['id']);
|
||||||
|
|
||||||
if (empty($values)) {
|
if (empty($values)) {
|
||||||
|
|
||||||
$values = array(
|
$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'),
|
'column_id' => $this->request->getIntegerParam('column_id'),
|
||||||
'color_id' => $this->request->getStringParam('color_id'),
|
'color_id' => $this->request->getStringParam('color_id'),
|
||||||
'owner_id' => $this->request->getIntegerParam('owner_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),
|
'users_list' => $this->projectPermission->getMemberList($project['id'], true, false, true),
|
||||||
'colors_list' => $this->color->getList(),
|
'colors_list' => $this->color->getList(),
|
||||||
'categories_list' => $this->category->getList($project['id']),
|
'categories_list' => $this->category->getList($project['id']),
|
||||||
|
'swimlanes_list' => $swimlanes_list,
|
||||||
'date_format' => $this->config->get('application_date_format'),
|
'date_format' => $this->config->get('application_date_format'),
|
||||||
'date_formats' => $this->dateParser->getAvailableFormats(),
|
'date_formats' => $this->dateParser->getAvailableFormats(),
|
||||||
'title' => $project['name'].' > '.t('New task')
|
'title' => $project['name'].' > '.t('New task')
|
||||||
|
|||||||
@@ -99,10 +99,16 @@ class Swimlane extends Base
|
|||||||
*/
|
*/
|
||||||
public function getDefault($project_id)
|
public function getDefault($project_id)
|
||||||
{
|
{
|
||||||
return $this->db->table(Project::TABLE)
|
$result = $this->db->table(Project::TABLE)
|
||||||
->eq('id', $project_id)
|
->eq('id', $project_id)
|
||||||
->columns('id', 'default_swimlane', 'show_default_swimlane')
|
->columns('id', 'default_swimlane', 'show_default_swimlane')
|
||||||
->findOne();
|
->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');
|
->findOneColumn('default_swimlane');
|
||||||
|
|
||||||
if ($default_swimlane) {
|
if ($default_swimlane) {
|
||||||
|
|
||||||
|
if ($default_swimlane === 'Default swimlane') {
|
||||||
|
$default_swimlane = t($default_swimlane);
|
||||||
|
}
|
||||||
|
|
||||||
array_unshift($swimlanes, array('id' => 0, 'name' => $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)
|
public function getList($project_id, $prepend = false)
|
||||||
{
|
{
|
||||||
$swimlanes = array();
|
$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(
|
if ($prepend) {
|
||||||
$swimlanes,
|
$swimlanes[-1] = t('All swimlanes');
|
||||||
$this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->orderBy('name', 'asc')->getAll('id', 'name')
|
}
|
||||||
);
|
|
||||||
|
|
||||||
return $prepend ? array(-1 => t('All swimlanes')) + $swimlanes : $swimlanes;
|
if (! empty($default)) {
|
||||||
|
$swimlanes[0] = $default === 'Default swimlane' ? t($default) : $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $swimlanes + $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->orderBy('position', 'asc')->getAll('id', 'name');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
|
|
||||||
<div class="form-column">
|
<div class="form-column">
|
||||||
<?= $this->formHidden('project_id', $values) ?>
|
<?= $this->formHidden('project_id', $values) ?>
|
||||||
<?= $this->formHidden('swimlane_id', $values) ?>
|
|
||||||
|
|
||||||
<?= $this->formLabel(t('Assignee'), 'owner_id') ?>
|
<?= $this->formLabel(t('Assignee'), 'owner_id') ?>
|
||||||
<?= $this->formSelect('owner_id', $users_list, $values, $errors) ?><br/>
|
<?= $this->formSelect('owner_id', $users_list, $values, $errors) ?><br/>
|
||||||
@@ -55,6 +54,9 @@
|
|||||||
<?= $this->formLabel(t('Category'), 'category_id') ?>
|
<?= $this->formLabel(t('Category'), 'category_id') ?>
|
||||||
<?= $this->formSelect('category_id', $categories_list, $values, $errors) ?><br/>
|
<?= $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->formLabel(t('Column'), 'column_id') ?>
|
||||||
<?= $this->formSelect('column_id', $columns_list, $values, $errors) ?><br/>
|
<?= $this->formSelect('column_id', $columns_list, $values, $errors) ?><br/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user