summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorOlivier Maridat <olivier.maridat@trialog.com>2017-07-11 12:51:28 +0200
committerFrédéric Guillot <fred@kanboard.net>2017-07-16 19:21:22 -0400
commit46974915b328d90a140dc9c27229d10742343b00 (patch)
tree0800722e3910e2ec4760f1bc88f066f7442f65e2 /app
parent347aff94ded8920ff3ba5544aec20804b9d4279e (diff)
Add "Create another link" checkbox for internal link as in sub-task creation
Diffstat (limited to 'app')
-rw-r--r--app/Controller/TaskInternalLinkController.php19
-rw-r--r--app/Locale/fr_FR/translations.php1
-rw-r--r--app/Template/task_internal_link/create.php2
3 files changed, 21 insertions, 1 deletions
diff --git a/app/Controller/TaskInternalLinkController.php b/app/Controller/TaskInternalLinkController.php
index a140f1ff..7c800165 100644
--- a/app/Controller/TaskInternalLinkController.php
+++ b/app/Controller/TaskInternalLinkController.php
@@ -44,6 +44,13 @@ class TaskInternalLinkController extends BaseController
{
$task = $this->getTask();
+ if (empty($values)) {
+ $values = array(
+ 'another_tasklink' => $this->request->getIntegerParam('another_tasklink', 0)
+ );
+ $values = $this->hook->merge('controller:tasklink:form:default', $values, array('default_values' => $values));
+ }
+
$this->response->html($this->template->render('task_internal_link/create', array(
'values' => $values,
'errors' => $errors,
@@ -65,8 +72,18 @@ class TaskInternalLinkController extends BaseController
list($valid, $errors) = $this->taskLinkValidator->validateCreation($values);
if ($valid) {
- if ($this->taskLinkModel->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
+ if ($this->taskLinkModel->create($values['task_id'], $values['opposite_task_id'], $values['link_id']) !== false) {
$this->flash->success(t('Link added successfully.'));
+
+ if (isset($values['another_tasklink']) && $values['another_tasklink'] == 1) {
+ return $this->create(array(
+ 'project_id' => $task['project_id'],
+ 'task_id' => $task['id'],
+ 'link_id' => $values['link_id'],
+ 'another_tasklink' => 1
+ ));
+ }
+
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
}
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 5e183eaf..c3cb6b43 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -1338,4 +1338,5 @@ return array(
'This task was sent by email to "%s" with subject "%s".' => 'Cette tâche a été envoyée par courrier électronique à « %s » avec le sujet « %s ».',
'Predefined Email Subjects' => 'Sujets de courrier électronique prédéfinis',
'Write one subject by line.' => 'Écrivez un sujet par ligne.',
+ 'Create another link' => 'Créer un autre lien',
);
diff --git a/app/Template/task_internal_link/create.php b/app/Template/task_internal_link/create.php
index 3c39b87c..c5e80f41 100644
--- a/app/Template/task_internal_link/create.php
+++ b/app/Template/task_internal_link/create.php
@@ -25,5 +25,7 @@
),
'autocomplete') ?>
+ <?= $this->form->checkbox('another_tasklink', t('Create another link'), 1, isset($values['another_tasklink']) && $values['another_tasklink'] == 1) ?>
+
<?= $this->modal->submitButtons() ?>
</form>