summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-10-12 14:01:39 -0700
committerFrederic Guillot <fred@kanboard.net>2017-10-12 14:01:39 -0700
commit4bb422b41fd995cb67c41ad4b7ba155a84c6f1eb (patch)
tree24368daa9fdd4881563aca74ab05322da2791fd5
parentad6f898134a3aadc38571f5c8e11d37f43a953e3 (diff)
Render a dropdown menu for external task providers
-rw-r--r--app/Core/ExternalTask/ExternalTaskManager.php10
-rw-r--r--app/Core/ExternalTask/ExternalTaskProviderInterface.php16
-rw-r--r--app/Helper/TaskHelper.php54
-rw-r--r--app/Locale/bs_BA/translations.php1
-rw-r--r--app/Locale/ca_ES/translations.php1
-rw-r--r--app/Locale/cs_CZ/translations.php1
-rw-r--r--app/Locale/da_DK/translations.php1
-rw-r--r--app/Locale/de_DE/translations.php1
-rw-r--r--app/Locale/el_GR/translations.php1
-rw-r--r--app/Locale/es_ES/translations.php1
-rw-r--r--app/Locale/fi_FI/translations.php1
-rw-r--r--app/Locale/fr_FR/translations.php1
-rw-r--r--app/Locale/hr_HR/translations.php1
-rw-r--r--app/Locale/hu_HU/translations.php1
-rw-r--r--app/Locale/id_ID/translations.php1
-rw-r--r--app/Locale/it_IT/translations.php1
-rw-r--r--app/Locale/ja_JP/translations.php1
-rw-r--r--app/Locale/ko_KR/translations.php1
-rw-r--r--app/Locale/my_MY/translations.php1
-rw-r--r--app/Locale/nb_NO/translations.php1
-rw-r--r--app/Locale/nl_NL/translations.php1
-rw-r--r--app/Locale/pl_PL/translations.php1
-rw-r--r--app/Locale/pt_BR/translations.php1
-rw-r--r--app/Locale/pt_PT/translations.php1
-rw-r--r--app/Locale/ru_RU/translations.php1
-rw-r--r--app/Locale/sr_Latn_RS/translations.php1
-rw-r--r--app/Locale/sv_SE/translations.php1
-rw-r--r--app/Locale/th_TH/translations.php1
-rw-r--r--app/Locale/tr_TR/translations.php1
-rw-r--r--app/Locale/vi_VN/translations.php1
-rw-r--r--app/Locale/zh_CN/translations.php1
-rw-r--r--app/Template/board/table_column.php4
32 files changed, 109 insertions, 3 deletions
diff --git a/app/Core/ExternalTask/ExternalTaskManager.php b/app/Core/ExternalTask/ExternalTaskManager.php
index 102ec459..87a46b71 100644
--- a/app/Core/ExternalTask/ExternalTaskManager.php
+++ b/app/Core/ExternalTask/ExternalTaskManager.php
@@ -55,4 +55,14 @@ class ExternalTaskManager
return array();
}
+
+ /**
+ * Get all providers
+ *
+ * @return ExternalTaskProviderInterface[]
+ */
+ public function getProviders()
+ {
+ return $this->providers;
+ }
}
diff --git a/app/Core/ExternalTask/ExternalTaskProviderInterface.php b/app/Core/ExternalTask/ExternalTaskProviderInterface.php
index f67f7552..5678efb8 100644
--- a/app/Core/ExternalTask/ExternalTaskProviderInterface.php
+++ b/app/Core/ExternalTask/ExternalTaskProviderInterface.php
@@ -19,6 +19,22 @@ interface ExternalTaskProviderInterface
public function getName();
/**
+ * Get provider icon
+ *
+ * @access public
+ * @return string
+ */
+ public function getIcon();
+
+ /**
+ * Get label for adding a new task
+ *
+ * @access public
+ * @return string
+ */
+ public function getMenuAddLabel();
+
+ /**
* Retrieve task from external system or cache
*
* @access public
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;
+ }
}
diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php
index bddfafe7..5d9757fb 100644
--- a/app/Locale/bs_BA/translations.php
+++ b/app/Locale/bs_BA/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php
index 7e8100dc..5c39c926 100644
--- a/app/Locale/ca_ES/translations.php
+++ b/app/Locale/ca_ES/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index 922cec5e..178ce0e2 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index d5126359..277efcee 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 51f544e8..496a11f2 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -1340,4 +1340,5 @@ return array(
'Write one subject by line.' => 'Schreibe ein Betreff pro Zeile.',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php
index 926cfd28..2ce91756 100644
--- a/app/Locale/el_GR/translations.php
+++ b/app/Locale/el_GR/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index b05ad4da..65424fd2 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -1340,4 +1340,5 @@ return array(
'Write one subject by line.' => 'Escriba un asunto por línea.',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index 3c65ab7e..98f5e216 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index b1845377..0fe5f17b 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -1340,4 +1340,5 @@ return array(
'Write one subject by line.' => 'Écrivez un sujet par ligne.',
'Create another link' => 'Créer un autre lien',
'BRL - Brazilian Real' => 'BRL - Real brésilien',
+ 'Add a new Kanboard task' => 'Ajouter une nouvelle tâche Kanboard',
);
diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php
index 0d690b61..f0cf0ae1 100644
--- a/app/Locale/hr_HR/translations.php
+++ b/app/Locale/hr_HR/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index 5f17805b..7e4809f5 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php
index 653bcf9d..5a3ea6a1 100644
--- a/app/Locale/id_ID/translations.php
+++ b/app/Locale/id_ID/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 45a58944..8252c3d0 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 70da2a8d..b7f592c3 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php
index 4f164e36..c85e3469 100644
--- a/app/Locale/ko_KR/translations.php
+++ b/app/Locale/ko_KR/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php
index 95c09334..86e92360 100644
--- a/app/Locale/my_MY/translations.php
+++ b/app/Locale/my_MY/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index 8f5482a3..56b58eec 100644
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index a8de3aa3..cb588a66 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index 58cfb42e..662bcd96 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index cf46cf9a..38e9a072 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -1340,4 +1340,5 @@ return array(
'Write one subject by line.' => 'Escreva um assunto por linha.',
'Create another link' => 'Criar outro link',
'BRL - Brazilian Real' => 'BRL - Real Brasileiro',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index 25f8ff4a..d0cf5d70 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -1340,4 +1340,5 @@ return array(
'Write one subject by line.' => 'Escreva um assunto por linha.',
'Create another link' => 'Criar outro link',
'BRL - Brazilian Real' => 'BRL - Real Brasileiro',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 11571df7..90bac3f6 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -1340,4 +1340,5 @@ return array(
'Write one subject by line.' => 'Записываются по одной теме на строку.',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index 97062ec6..aa4d29e7 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index 7bc73b44..882ccce5 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 871c21ba..d5f49540 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index 7f55634f..efcbbbd7 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -1340,4 +1340,5 @@ return array(
'Write one subject by line.' => 'Her satıra bir konu yazınız',
'Create another link' => 'Başka bağlantı oluştur',
'BRL - Brazilian Real' => 'BRL - Brezilya Reali',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php
index 387791b5..7fa77c9f 100644
--- a/app/Locale/vi_VN/translations.php
+++ b/app/Locale/vi_VN/translations.php
@@ -1346,4 +1346,5 @@ return array(
'Write one subject by line.' => 'Viết một chủ đề theo dòng.',
'Create another link' => 'Tạo liên kết khác',
'BRL - Brazilian Real' => 'BRL - Brazilian Real',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 8df657cb..5cea713f 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -1340,4 +1340,5 @@ return array(
// 'Write one subject by line.' => '',
// 'Create another link' => '',
// 'BRL - Brazilian Real' => '',
+ // 'Add a new Kanboard task' => '',
);
diff --git a/app/Template/board/table_column.php b/app/Template/board/table_column.php
index 9d2815ff..a9652a2b 100644
--- a/app/Template/board/table_column.php
+++ b/app/Template/board/table_column.php
@@ -16,9 +16,7 @@
<!-- column in expanded mode -->
<div class="board-column-expanded">
<?php if (! $not_editable && $this->projectRole->canCreateTaskInColumn($column['project_id'], $column['id'])): ?>
- <div class="board-add-icon">
- <?= $this->modal->largeIcon('plus', t('Add a new task'), 'TaskCreationController', 'show', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id'])) ?>
- </div>
+ <?= $this->task->getNewBoardTaskButton($swimlane, $column) ?>
<?php endif ?>
<?php if ($swimlane['nb_swimlanes'] > 1 && ! empty($column['column_nb_tasks'])): ?>