Render a dropdown menu for external task providers

This commit is contained in:
Frederic Guillot
2017-10-12 14:01:39 -07:00
parent ad6f898134
commit 4bb422b41f
32 changed files with 109 additions and 3 deletions

View File

@@ -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;
}
}