From 26492aba7ee2bfb8c525ea0aaa580aff47a414ba Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 31 Jan 2016 21:44:49 -0500 Subject: Simplify layout and templates generation --- app/Controller/Subtask.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/Controller/Subtask.php') diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index caaaa85e..526962a9 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -45,7 +45,7 @@ class Subtask extends Base ); } - $this->response->html($this->taskLayout('subtask/create', array( + $this->response->html($this->helper->layout->task('subtask/create', array( 'values' => $values, 'errors' => $errors, 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), @@ -92,7 +92,7 @@ class Subtask extends Base $task = $this->getTask(); $subtask = $this->getSubTask(); - $this->response->html($this->taskLayout('subtask/edit', array( + $this->response->html($this->helper->layout->task('subtask/edit', array( 'values' => empty($values) ? $subtask : $values, 'errors' => $errors, 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), @@ -138,7 +138,7 @@ class Subtask extends Base $task = $this->getTask(); $subtask = $this->getSubtask(); - $this->response->html($this->taskLayout('subtask/remove', array( + $this->response->html($this->helper->layout->task('subtask/remove', array( 'subtask' => $subtask, 'task' => $task, ))); -- cgit v1.2.3 From 5eb4b570a12a590a98c66d253b0ba54c6062a997 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 2 Feb 2016 21:28:07 -0500 Subject: Show subtask modification forms in inline popup --- ChangeLog | 1 + app/Controller/Subtask.php | 30 +++++++++++++++++++++++++----- app/Template/subtask/create.php | 4 ++-- app/Template/subtask/edit.php | 4 ++-- app/Template/subtask/remove.php | 2 +- app/Template/subtask/show.php | 22 +++++++++------------- app/Template/task/show.php | 1 + app/Template/task/sidebar.php | 15 ++++++++++++--- assets/js/app.js | 2 +- assets/js/src/Popover.js | 4 ++-- 10 files changed, 56 insertions(+), 29 deletions(-) (limited to 'app/Controller/Subtask.php') diff --git a/ChangeLog b/ChangeLog index 3fa18d9b..95d14a63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ New features: Improvements: +* Use inline popup for subtasks modification * Move homepage menus to the user dropdown * Have a new task assigned to the creator by default instead of "no assignee" * Show progress for task links in board tooltips diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index 526962a9..9fe15c9d 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -29,6 +29,23 @@ class Subtask extends Base return $subtask; } + /** + * Show list of subtasks + */ + public function show() + { + $task = $this->getTask(); + + $this->response->html($this->helper->layout->task('subtask/show', array( + 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), + 'task' => $task, + 'project' => $this->getProject(), + 'subtasks' => $this->subtask->getAll($task['id']), + 'editable' => true, + 'redirect' => 'subtask', + ))); + } + /** * Creation form * @@ -73,10 +90,10 @@ class Subtask extends Base } if (isset($values['another_subtask']) && $values['another_subtask'] == 1) { - $this->response->redirect($this->helper->url->to('subtask', 'create', array('project_id' => $task['project_id'], 'task_id' => $task['id'], 'another_subtask' => 1))); + return $this->create(array('project_id' => $task['project_id'], 'task_id' => $task['id'], 'another_subtask' => 1)); } - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks')); + return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'), true); } $this->create($values, $errors); @@ -122,7 +139,7 @@ class Subtask extends Base $this->flash->failure(t('Unable to update your sub-task.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks')); + return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } $this->edit($values, $errors); @@ -161,7 +178,7 @@ class Subtask extends Base $this->flash->failure(t('Unable to remove this sub-task.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks')); + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } /** @@ -249,6 +266,8 @@ class Subtask extends Base $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); case 'dashboard': $this->response->redirect($this->helper->url->to('app', 'index')); + case 'subtask': + $this->response->redirect($this->helper->url->to('subtask', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); default: $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'subtasks')); } @@ -267,8 +286,9 @@ class Subtask extends Base $subtask_id = $this->request->getIntegerParam('subtask_id'); $direction = $this->request->getStringParam('direction'); $method = $direction === 'up' ? 'moveUp' : 'moveDown'; + $redirect = $this->request->getStringParam('redirect', 'task'); $this->subtask->$method($task_id, $subtask_id); - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $project_id, 'task_id' => $task_id), 'subtasks')); + $this->response->redirect($this->helper->url->to($redirect, 'show', array('project_id' => $project_id, 'task_id' => $task_id), 'subtasks')); } } diff --git a/app/Template/subtask/create.php b/app/Template/subtask/create.php index e237619e..8fffd3a9 100644 --- a/app/Template/subtask/create.php +++ b/app/Template/subtask/create.php @@ -2,7 +2,7 @@

-
+ form->csrf() ?> form->hidden('task_id', $values) ?> @@ -15,6 +15,6 @@
- url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
diff --git a/app/Template/subtask/edit.php b/app/Template/subtask/edit.php index ca028108..acce625e 100644 --- a/app/Template/subtask/edit.php +++ b/app/Template/subtask/edit.php @@ -2,7 +2,7 @@

-
+ form->csrf() ?> form->hidden('id', $values) ?> @@ -15,6 +15,6 @@
- url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
diff --git a/app/Template/subtask/remove.php b/app/Template/subtask/remove.php index 65ade31d..9aef6842 100644 --- a/app/Template/subtask/remove.php +++ b/app/Template/subtask/remove.php @@ -12,6 +12,6 @@
url->link(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
\ No newline at end of file diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php index 6945840f..027e9495 100644 --- a/app/Template/subtask/show.php +++ b/app/Template/subtask/show.php @@ -1,9 +1,10 @@ + +
- @@ -20,7 +21,7 @@ - subtask->toggleStatus($subtask, 'task') ?> + subtask->toggleStatus($subtask, $redirect) ?> render('subtask/icons', array('subtask' => $subtask)) . $this->e($subtask['title']) ?> @@ -66,19 +67,19 @@
  • - url->link(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up'), true) ?> + url->link(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up', 'redirect' => $redirect), true) ?>
  • - url->link(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down'), true) ?> + url->link(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down', 'redirect' => $redirect), true) ?>
  • - url->link(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?> + url->link(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), false, 'popover') ?>
  • - url->link(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?> + url->link(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), false, 'popover') ?>
@@ -90,11 +91,6 @@ user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?> - - -
form->csrf() ?> form->hidden('task_id', array('task_id' => $task['id'])) ?> diff --git a/app/Template/task/show.php b/app/Template/task/show.php index 5fd73afb..246c8f33 100644 --- a/app/Template/task/show.php +++ b/app/Template/task/show.php @@ -19,6 +19,7 @@ 'project' => $project, 'users_list' => isset($users_list) ? $users_list : array(), 'editable' => $this->user->hasProjectAccess('subtask', 'edit', $project['id']), + 'redirect' => 'task', )) ?> render('tasklink/show', array( diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php index b5a2c4b4..81cd3434 100644 --- a/app/Template/task/sidebar.php +++ b/app/Template/task/sidebar.php @@ -22,6 +22,18 @@ hook->render('template:task:sidebar:information') ?> +

+
    +
  • app->checkMenuSelection('subtask', 'show') ?>> + url->link(t('View all sub-tasks'), 'subtask', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> +
  • + user->hasProjectAccess('subtask', 'create', $task['project_id'])): ?> +
  • app->checkMenuSelection('subtask', 'create') ?>> + url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> +
  • + +
+