From c9ba525bab06eff76b1d5fb8701848d0e3990122 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 21 May 2015 22:28:28 -0400 Subject: Show swimlane dropdown only when necessary --- app/Controller/Task.php | 2 +- app/Model/Swimlane.php | 9 +++++++-- app/Template/task/new.php | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 060a478c..c2e66245 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -113,7 +113,7 @@ class Task extends Base { $project = $this->getProject(); $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)) { diff --git a/app/Model/Swimlane.php b/app/Model/Swimlane.php index cf2103c2..cfd6d4a7 100644 --- a/app/Model/Swimlane.php +++ b/app/Model/Swimlane.php @@ -189,9 +189,10 @@ class Swimlane extends Base * @access public * @param integer $project_id Project id * @param boolean $prepend Prepend default value + * @param boolean $only_active Return only active swimlanes * @return array */ - public function getList($project_id, $prepend = false) + public function getList($project_id, $prepend = false, $only_active = false) { $swimlanes = array(); $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; } - 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'); } /** diff --git a/app/Template/task/new.php b/app/Template/task/new.php index 4bfb8064..37294c89 100644 --- a/app/Template/task/new.php +++ b/app/Template/task/new.php @@ -54,8 +54,10 @@ formLabel(t('Category'), 'category_id') ?> formSelect('category_id', $categories_list, $values, $errors) ?>
+ formLabel(t('Swimlane'), 'swimlane_id') ?> formSelect('swimlane_id', $swimlanes_list, $values, $errors) ?>
+ formLabel(t('Column'), 'column_id') ?> formSelect('column_id', $columns_list, $values, $errors) ?>
-- cgit v1.2.3