Show swimlane dropdown only when necessary
This commit is contained in:
@@ -113,7 +113,7 @@ 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']);
|
$swimlanes_list = $this->swimlane->getList($project['id'], false, true);
|
||||||
|
|
||||||
if (empty($values)) {
|
if (empty($values)) {
|
||||||
|
|
||||||
|
|||||||
@@ -189,9 +189,10 @@ class Swimlane extends Base
|
|||||||
* @access public
|
* @access public
|
||||||
* @param integer $project_id Project id
|
* @param integer $project_id Project id
|
||||||
* @param boolean $prepend Prepend default value
|
* @param boolean $prepend Prepend default value
|
||||||
|
* @param boolean $only_active Return only active swimlanes
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getList($project_id, $prepend = false)
|
public function getList($project_id, $prepend = false, $only_active = false)
|
||||||
{
|
{
|
||||||
$swimlanes = array();
|
$swimlanes = array();
|
||||||
$default = $this->db->table(Project::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane');
|
$default = $this->db->table(Project::TABLE)->eq('id', $project_id)->eq('show_default_swimlane', 1)->findOneColumn('default_swimlane');
|
||||||
@@ -204,7 +205,11 @@ class Swimlane extends Base
|
|||||||
$swimlanes[0] = $default === 'Default swimlane' ? t($default) : $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');
|
return $swimlanes + $this->db->hashtable(self::TABLE)
|
||||||
|
->eq('project_id', $project_id)
|
||||||
|
->in('is_active', $only_active ? array(self::ACTIVE) : array(self::ACTIVE, self::INACTIVE))
|
||||||
|
->orderBy('position', 'asc')
|
||||||
|
->getAll('id', 'name');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,8 +54,10 @@
|
|||||||
<?= $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/>
|
||||||
|
|
||||||
|
<?php if (! (count($swimlanes_list) === 1 && key($swimlanes_list) === 0)): ?>
|
||||||
<?= $this->formLabel(t('Swimlane'), 'swimlane_id') ?>
|
<?= $this->formLabel(t('Swimlane'), 'swimlane_id') ?>
|
||||||
<?= $this->formSelect('swimlane_id', $swimlanes_list, $values, $errors) ?><br/>
|
<?= $this->formSelect('swimlane_id', $swimlanes_list, $values, $errors) ?><br/>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<?= $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