summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-11-03 10:57:00 -0700
committerFrederic Guillot <fred@kanboard.net>2017-11-03 10:57:00 -0700
commite6f8a76a188960512ced32133b85686d9a8d9090 (patch)
treea7d4ff84eb127a8d542244e276c4775886c88a85 /app
parent78a2d3142c8da35ed072fdb035a2351594b128cc (diff)
Use task description templates in bulk task creation
Diffstat (limited to 'app')
-rw-r--r--app/Controller/TaskBulkController.php11
-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/Model/PredefinedTaskDescriptionModel.php10
-rw-r--r--app/Template/task_bulk/show.php6
-rw-r--r--app/Validator/TaskValidator.php1
32 files changed, 54 insertions, 2 deletions
diff --git a/app/Controller/TaskBulkController.php b/app/Controller/TaskBulkController.php
index 4345a68f..0f49fb76 100644
--- a/app/Controller/TaskBulkController.php
+++ b/app/Controller/TaskBulkController.php
@@ -35,6 +35,7 @@ class TaskBulkController extends BaseController
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, $project['is_private'] == 1),
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
+ 'task_description_templates' => $this->predefinedTaskDescriptionModel->getList($project['id']),
)));
}
@@ -85,8 +86,18 @@ class TaskBulkController extends BaseController
'owner_id' => empty($values['owner_id']) ? 0 : $values['owner_id'],
'color_id' => $values['color_id'],
'project_id' => $project['id'],
+ 'description' => $this->getTaskDescription($project, $values),
));
}
}
}
+
+ protected function getTaskDescription(array $project, array $values)
+ {
+ if (empty($values['task_description_template_id'])) {
+ return '';
+ }
+
+ return $this->predefinedTaskDescriptionModel->getDescriptionById($project['id'], $values['task_description_template_id']);
+ }
}
diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php
index d53f9291..f9e972e2 100644
--- a/app/Locale/bs_BA/translations.php
+++ b/app/Locale/bs_BA/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php
index f114484f..68d01b83 100644
--- a/app/Locale/ca_ES/translations.php
+++ b/app/Locale/ca_ES/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index 8b713c8c..5ede8fbc 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index fef985b4..21ab41d6 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index e2d9ba5a..177fdadf 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php
index 908c015e..86bbe7ac 100644
--- a/app/Locale/el_GR/translations.php
+++ b/app/Locale/el_GR/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index b97e24eb..6970fa70 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index a508162d..c7030ca5 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index d281def6..c3f0bb90 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -1356,4 +1356,5 @@ return array(
'Template removed successfully.' => 'Modèle supprimé avec succès.',
'Unable to remove this template.' => 'Impossible de supprimer ce modèle.',
'Description Templates' => 'Modèles de description',
+ 'Template for the task description' => 'Modèle pour la description des tâches',
);
diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php
index 5f2f0a70..f7de65aa 100644
--- a/app/Locale/hr_HR/translations.php
+++ b/app/Locale/hr_HR/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index 740a8e4f..8900b62f 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php
index 2fcbbf76..af772399 100644
--- a/app/Locale/id_ID/translations.php
+++ b/app/Locale/id_ID/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 13cfd247..f466d9b9 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 1c7c8879..ad1cabb7 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php
index 8eafaedb..8969f909 100644
--- a/app/Locale/ko_KR/translations.php
+++ b/app/Locale/ko_KR/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php
index b0bcf90f..8e612928 100644
--- a/app/Locale/my_MY/translations.php
+++ b/app/Locale/my_MY/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index 9f563fd5..f5f481e8 100644
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index eeb99d5f..1adb9e8a 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index ec684e98..87d94490 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 47e7b629..1f9de451 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index a8abeda3..cc7f0f2e 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 940e58f5..5c54386c 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index 0628ebd5..d5a0818d 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index f20f0501..ccba5e95 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 0d26b352..21b9232f 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index a7ffda9a..bf2f7ff6 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php
index bf9e6ffd..1e8ba674 100644
--- a/app/Locale/vi_VN/translations.php
+++ b/app/Locale/vi_VN/translations.php
@@ -1362,4 +1362,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 68bbef66..b215302f 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -1356,4 +1356,5 @@ return array(
// 'Template removed successfully.' => '',
// 'Unable to remove this template.' => '',
// 'Description Templates' => '',
+ // 'Template for the task description' => '',
);
diff --git a/app/Model/PredefinedTaskDescriptionModel.php b/app/Model/PredefinedTaskDescriptionModel.php
index 7b8e6de2..aaa4d23e 100644
--- a/app/Model/PredefinedTaskDescriptionModel.php
+++ b/app/Model/PredefinedTaskDescriptionModel.php
@@ -13,11 +13,21 @@ class PredefinedTaskDescriptionModel extends Base
return $this->db->table(self::TABLE)->eq('project_id', $projectId)->findAll();
}
+ public function getList($projectId)
+ {
+ return array('' => t('None')) + $this->db->hashtable(self::TABLE)->eq('project_id', $projectId)->getAll('id', 'title');
+ }
+
public function getById($projectId, $id)
{
return $this->db->table(self::TABLE)->eq('project_id', $projectId)->eq('id', $id)->findOne();
}
+ public function getDescriptionById($projectId, $id)
+ {
+ return $this->db->table(self::TABLE)->eq('project_id', $projectId)->eq('id', $id)->findOneColumn('description');
+ }
+
public function create($projectId, $title, $description)
{
return $this->db->table(self::TABLE)->persist(array(
diff --git a/app/Template/task_bulk/show.php b/app/Template/task_bulk/show.php
index acf80d8c..b13cf239 100644
--- a/app/Template/task_bulk/show.php
+++ b/app/Template/task_bulk/show.php
@@ -6,12 +6,16 @@
<?= $this->form->csrf() ?>
<?= $this->form->hidden('column_id', $values) ?>
<?= $this->form->hidden('swimlane_id', $values) ?>
- <?= $this->form->hidden('project_id', $values) ?>
<?= $this->task->renderColorField($values) ?>
<?= $this->task->renderAssigneeField($users_list, $values, $errors) ?>
<?= $this->task->renderCategoryField($categories_list, $values, $errors) ?>
+ <?php if (! empty($task_description_templates)): ?>
+ <?= $this->form->label(t('Template for the task description'), 'task_description_template_id') ?>
+ <?= $this->form->select('task_description_template_id', $task_description_templates, $values, $errors) ?>
+ <?php endif ?>
+
<?= $this->form->label(t('Tasks'), 'tasks') ?>
<?= $this->form->textarea('tasks', $values, $errors, array('placeholder="'.t('My task title').'"')) ?>
<p class="form-help"><?= t('Enter one task by line.') ?></p>
diff --git a/app/Validator/TaskValidator.php b/app/Validator/TaskValidator.php
index f9441c8b..fced763a 100644
--- a/app/Validator/TaskValidator.php
+++ b/app/Validator/TaskValidator.php
@@ -81,7 +81,6 @@ class TaskValidator extends BaseValidator
public function validateBulkCreation(array $values)
{
$rules = array(
- new Validators\Required('project_id', t('The project is required')),
new Validators\Required('tasks', t('Field required')),
new Validators\Required('column_id', t('Field required')),
new Validators\Required('swimlane_id', t('Field required')),