diff --git a/app/Controller/SubtaskController.php b/app/Controller/SubtaskController.php index 7502d84f9..134b057e2 100644 --- a/app/Controller/SubtaskController.php +++ b/app/Controller/SubtaskController.php @@ -27,10 +27,7 @@ class SubtaskController extends BaseController $task = $this->getTask(); if (empty($values)) { - $values = array( - 'task_id' => $task['id'], - 'another_subtask' => $this->request->getIntegerParam('another_subtask', 0) - ); + $values = $this->prepareValues($task); } $this->response->html($this->template->render('subtask/create', array( @@ -40,6 +37,24 @@ class SubtaskController extends BaseController 'task' => $task, ))); } + + /** + * Prepare form values + * + * @access protected + * @param array $task + * @return array + */ + protected function prepareValues(array $task) + { + $values = array( + 'task_id' => $task['id'], + 'another_subtask' => $this->request->getIntegerParam('another_subtask', 0) + ); + + $values = $this->hook->merge('controller:subtask:form:default', $values, array('default_values' => $values)); + return $values; + } /** * Validation and creation diff --git a/app/Model/SubtaskModel.php b/app/Model/SubtaskModel.php index 608ffce74..737a933d9 100644 --- a/app/Model/SubtaskModel.php +++ b/app/Model/SubtaskModel.php @@ -255,6 +255,7 @@ class SubtaskModel extends Base { $this->helper->model->removeFields($values, array('another_subtask')); $this->helper->model->resetFields($values, array('time_estimated', 'time_spent')); + $this->hook->reference('model:subtask:modification:prepare', $values); } /** @@ -272,6 +273,7 @@ class SubtaskModel extends Base $values['time_estimated'] = isset($values['time_estimated']) ? $values['time_estimated'] : 0; $values['time_spent'] = isset($values['time_spent']) ? $values['time_spent'] : 0; $values['user_id'] = isset($values['user_id']) ? $values['user_id'] : 0; + $this->hook->reference('model:subtask:creation:prepare', $values); } /** diff --git a/app/Template/board/tooltip_subtasks.php b/app/Template/board/tooltip_subtasks.php index 8d5bc059e..335c28ce1 100644 --- a/app/Template/board/tooltip_subtasks.php +++ b/app/Template/board/tooltip_subtasks.php @@ -1,7 +1,8 @@
| = t('Subtask') ?> | += t('Subtask') ?> | + = $this->hook->render('template:board:tooltip:subtasks:header:before-assignee') ?>= t('Assignee') ?> | = $this->subtask->toggleStatus($subtask, $task['project_id']) ?> | + = $this->hook->render('template:board:tooltip:subtasks:rows', array('subtask' => $subtask)) ?>= $this->text->e($subtask['name'] ?: $subtask['username']) ?> diff --git a/app/Template/dashboard/subtasks.php b/app/Template/dashboard/subtasks.php index b71deeb92..13770f0f4 100644 --- a/app/Template/dashboard/subtasks.php +++ b/app/Template/dashboard/subtasks.php @@ -10,6 +10,7 @@ | = $paginator->order(t('Project'), 'project_name') ?> | = $paginator->order(t('Task'), 'task_name') ?> | = $paginator->order(t('Subtask'), \Kanboard\Model\SubtaskModel::TABLE.'.title') ?> | + = $this->hook->render('template:dashboard:subtasks:header:before-timetracking', array('paginator' => $paginator)) ?>= t('Time tracking') ?> | getCollection() as $subtask): ?> @@ -26,6 +27,7 @@= $this->subtask->toggleStatus($subtask, $subtask['project_id']) ?> | + = $this->hook->render('template:dashboard:subtasks:rows', array('subtask' => $subtask)) ?>
= $this->text->e($subtask['time_spent']).'h' ?> = t('spent') ?>
diff --git a/app/Template/subtask/create.php b/app/Template/subtask/create.php
index 3c080f7c2..cc4ccba62 100644
--- a/app/Template/subtask/create.php
+++ b/app/Template/subtask/create.php
@@ -9,7 +9,8 @@
= $this->subtask->selectTitle($values, $errors, array('autofocus')) ?>
= $this->subtask->selectAssignee($users_list, $values, $errors) ?>
= $this->subtask->selectTimeEstimated($values, $errors) ?>
-
+ = $this->hook->render('template:subtask:form:create', array('values' => $values, 'errors' => $errors)) ?>
+
= $this->form->checkbox('another_subtask', t('Create another sub-task'), 1, isset($values['another_subtask']) && $values['another_subtask'] == 1) ?>
diff --git a/app/Template/subtask/edit.php b/app/Template/subtask/edit.php
index 8f256ceab..07419f790 100644
--- a/app/Template/subtask/edit.php
+++ b/app/Template/subtask/edit.php
@@ -11,7 +11,8 @@
= $this->subtask->selectAssignee($users_list, $values, $errors) ?>
= $this->subtask->selectTimeEstimated($values, $errors) ?>
= $this->subtask->selectTimeSpent($values, $errors) ?>
-
+ = $this->hook->render('template:subtask:form:edit', array('values' => $values, 'errors' => $errors)) ?>
+
= t('or') ?>
diff --git a/app/Template/subtask/table.php b/app/Template/subtask/table.php
index 5c60df449..bea49aed6 100644
--- a/app/Template/subtask/table.php
+++ b/app/Template/subtask/table.php
@@ -7,6 +7,7 @@
= t('Title') ?> |
= t('Assignee') ?> |
+ = $this->hook->render('template:subtask:table:header:before-timetracking') ?>
= t('Time tracking') ?> |
@@ -29,6 +30,7 @@
= $this->text->e($subtask['name'] ?: $subtask['username']) ?>
+ = $this->hook->render('template:subtask:table:rows', array('subtask' => $subtask)) ?>
|
|
|
|---|