diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-10-12 14:01:39 -0700 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-10-12 14:01:39 -0700 |
commit | 4bb422b41fd995cb67c41ad4b7ba155a84c6f1eb (patch) | |
tree | 24368daa9fdd4881563aca74ab05322da2791fd5 /app/Helper | |
parent | ad6f898134a3aadc38571f5c8e11d37f43a953e3 (diff) |
Render a dropdown menu for external task providers
Diffstat (limited to 'app/Helper')
-rw-r--r-- | app/Helper/TaskHelper.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index f3084759..3b9e9745 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -256,4 +256,58 @@ class TaskHelper extends Base $html .= '</ul></div></small>'; return $html; } + + public function getNewBoardTaskButton(array $swimlane, array $column) + { + $html = '<div class="board-add-icon">'; + $providers = $this->externalTaskManager->getProviders(); + + if (empty($providers)) { + $html .= $this->helper->modal->largeIcon( + 'plus', + t('Add a new task'), + 'TaskCreationController', + 'show', array( + 'project_id' => $column['project_id'], + 'column_id' => $column['id'], + 'swimlane_id' => $swimlane['id'], + ) + ); + } else { + $html .= '<div class="dropdown">'; + $html .= '<a href="#" class="dropdown-menu"><i class="fa fa-plus" aria-hidden="true"></i></a><ul>'; + + $link = $this->helper->modal->large( + 'plus', + t('Add a new Kanboard task'), + 'TaskCreationController', + 'show', array( + 'project_id' => $column['project_id'], + 'column_id' => $column['id'], + 'swimlane_id' => $swimlane['id'], + ) + ); + + $html .= '<li>'.$link.'</li>'; + + foreach ($providers as $provider) { + $link = $this->helper->url->link( + $provider->getMenuAddLabel(), + 'ExternalTaskCreationController', + 'step1', + array('project_id' => $column['project_id'], 'swimlane_id' => $swimlane['id'], 'column_id' => $column['id'], 'provider_name' => $provider->getName()), + false, + 'js-modal-large' + ); + + $html .= '<li>'.$provider->getIcon().' '.$link.'</li>'; + } + + $html .= '</ul></div>'; + } + + $html .= '</div>'; + + return $html; + } } |