From 854457baf0043b51ce9c30f36a6fecaed97cb04d Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Fri, 18 Mar 2016 21:00:14 -0400 Subject: Improve task summary sections --- app/Controller/Subtask.php | 17 ------ app/Controller/Task.php | 3 +- app/Controller/TaskExternalLink.php | 22 +------ app/Controller/Tasklink.php | 21 ------- app/Template/comment/create.php | 10 ++-- app/Template/comments/create.php | 36 ++++++++++++ app/Template/comments/show.php | 31 ++++++++++ app/Template/subtask/show.php | 44 ++++---------- app/Template/subtask/table.php | 2 - app/Template/task/comments.php | 35 ----------- app/Template/task/description.php | 21 +++---- app/Template/task/details.php | 7 +++ app/Template/task/public.php | 8 +-- app/Template/task/show.php | 20 +++---- app/Template/task/sidebar.php | 20 +++---- app/Template/task_external_link/show.php | 72 ++++------------------- app/Template/task_external_link/table.php | 42 +++++++++++++ app/Template/task_file/files.php | 47 +++++++++++++++ app/Template/task_file/images.php | 34 +++++++++++ app/Template/task_file/show.php | 97 +++---------------------------- app/Template/tasklink/show.php | 55 +++++------------- app/Template/tasklink/table.php | 4 +- 22 files changed, 278 insertions(+), 370 deletions(-) create mode 100644 app/Template/comments/create.php create mode 100644 app/Template/comments/show.php delete mode 100644 app/Template/task/comments.php create mode 100644 app/Template/task_external_link/table.php create mode 100644 app/Template/task_file/files.php create mode 100644 app/Template/task_file/images.php (limited to 'app') diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index bc2108f9..dea2b08e 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -10,23 +10,6 @@ namespace Kanboard\Controller; */ class Subtask extends Base { - /** - * 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, - 'show_title' => true, - ))); - } - /** * Creation form * diff --git a/app/Controller/Task.php b/app/Controller/Task.php index aeaf5792..dc10604e 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -76,7 +76,8 @@ class Task extends Base 'images' => $this->taskFile->getAllImages($task['id']), 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()), 'subtasks' => $subtasks, - 'links' => $this->taskLink->getAllGroupedByLabel($task['id']), + 'internal_links' => $this->taskLink->getAllGroupedByLabel($task['id']), + 'external_links' => $this->taskExternalLink->getAll($task['id']), 'task' => $task, 'values' => $values, 'link_label_list' => $this->link->getList(0, false), diff --git a/app/Controller/TaskExternalLink.php b/app/Controller/TaskExternalLink.php index 72015686..0db8ec37 100644 --- a/app/Controller/TaskExternalLink.php +++ b/app/Controller/TaskExternalLink.php @@ -12,22 +12,6 @@ use Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound; */ class TaskExternalLink extends Base { - /** - * Creation form - * - * @access public - */ - public function show() - { - $task = $this->getTask(); - - $this->response->html($this->helper->layout->task('task_external_link/show', array( - 'links' => $this->taskExternalLink->getAll($task['id']), - 'task' => $task, - 'title' => t('List of external links'), - ))); - } - /** * First creation form * @@ -90,7 +74,7 @@ class TaskExternalLink extends Base if ($valid && $this->taskExternalLink->create($values)) { $this->flash->success(t('Link added successfully.')); - return $this->response->redirect($this->helper->url->to('TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } $this->edit($values, $errors); @@ -137,7 +121,7 @@ class TaskExternalLink extends Base if ($valid && $this->taskExternalLink->update($values)) { $this->flash->success(t('Link updated successfully.')); - return $this->response->redirect($this->helper->url->to('TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } $this->edit($values, $errors); @@ -180,6 +164,6 @@ class TaskExternalLink extends Base $this->flash->failure(t('Unable to remove this link.')); } - $this->response->redirect($this->helper->url->to('TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); } } diff --git a/app/Controller/Tasklink.php b/app/Controller/Tasklink.php index b051caad..a7f4914b 100644 --- a/app/Controller/Tasklink.php +++ b/app/Controller/Tasklink.php @@ -28,27 +28,6 @@ class Tasklink extends Base return $link; } - /** - * Show links - * - * @access public - */ - public function show() - { - $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); - - $this->response->html($this->helper->layout->task('tasklink/show', array( - 'links' => $this->taskLink->getAllGroupedByLabel($task['id']), - 'task' => $task, - 'project' => $project, - 'link_label_list' => $this->link->getList(0, false), - 'editable' => true, - 'is_public' => false, - 'show_title' => true, - ))); - } - /** * Creation form * diff --git a/app/Template/comment/create.php b/app/Template/comment/create.php index 574eec9f..58b4abdf 100644 --- a/app/Template/comment/create.php +++ b/app/Template/comment/create.php @@ -1,7 +1,7 @@ -
+ form->csrf() ?> form->hidden('task_id', $values) ?> form->hidden('user_id', $values) ?> @@ -21,7 +21,7 @@ $values, $errors, array( - ! isset($skip_cancel) ? 'autofocus' : '', + 'autofocus', 'required', 'placeholder="'.t('Leave a comment').'"', 'data-mention-search-url="'.$this->url->href('UserHelper', 'mention', array('project_id' => $task['project_id'])).'"', @@ -38,9 +38,7 @@
- - - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> - + + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
diff --git a/app/Template/comments/create.php b/app/Template/comments/create.php new file mode 100644 index 00000000..87d69491 --- /dev/null +++ b/app/Template/comments/create.php @@ -0,0 +1,36 @@ +
+ form->csrf() ?> + form->hidden('task_id', $values) ?> + form->hidden('user_id', $values) ?> + +
+
    +
  • + +
  • +
  • + +
  • +
+
+ form->textarea( + 'comment', + $values, + $errors, + array( + 'required', + 'placeholder="'.t('Leave a comment').'"', + 'data-mention-search-url="'.$this->url->href('UserHelper', 'mention', array('project_id' => $task['project_id'])).'"', + ), + 'comment-textarea' + ) ?> +
+
+
+
+
+ +
+ +
+
diff --git a/app/Template/comments/show.php b/app/Template/comments/show.php new file mode 100644 index 00000000..ccc1d9cc --- /dev/null +++ b/app/Template/comments/show.php @@ -0,0 +1,31 @@ +
+
+

+
+
+
+ + url->link(t('change sorting'), 'comment', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> +
+ + render('comment/show', array( + 'comment' => $comment, + 'task' => $task, + 'project' => $project, + 'editable' => $editable, + 'is_public' => isset($is_public) && $is_public, + )) ?> + + + + render('comments/create', array( + 'values' => array( + 'user_id' => $this->user->getId(), + 'task_id' => $task['id'], + ), + 'errors' => array(), + 'task' => $task, + )) ?> + +
+
\ No newline at end of file diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php index 0e94a305..fe436d51 100644 --- a/app/Template/subtask/show.php +++ b/app/Template/subtask/show.php @@ -1,32 +1,12 @@ - -
-

text->e($task['title']) ?>

-
- - - - -
- - render('subtask/table', array('subtasks' => $subtasks, 'task' => $task, 'editable' => $editable)) ?> - - user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?> -
- form->csrf() ?> - form->hidden('task_id', array('task_id' => $task['id'])) ?> - form->text('title', array(), array(), array('required', 'placeholder="'.t('Type here to create a new sub-task').'"')) ?> - form->numeric('time_estimated', array(), array(), array('placeholder="'.t('Original estimate').'"')) ?> - form->select('user_id', $users_list, array(), array(), array('placeholder="'.t('Assignee').'"')) ?> - -
- - -
+
+
+

+
+
+ render('subtask/table', array( + 'subtasks' => $subtasks, + 'task' => $task, + 'editable' => $editable + )) ?> +
+
diff --git a/app/Template/subtask/table.php b/app/Template/subtask/table.php index 0af02dcf..40510a2f 100644 --- a/app/Template/subtask/table.php +++ b/app/Template/subtask/table.php @@ -66,6 +66,4 @@ - -

diff --git a/app/Template/task/comments.php b/app/Template/task/comments.php deleted file mode 100644 index c22e39ec..00000000 --- a/app/Template/task/comments.php +++ /dev/null @@ -1,35 +0,0 @@ - -
- - - - render('comment/show', array( - 'comment' => $comment, - 'task' => $task, - 'project' => $project, - 'editable' => $editable, - 'is_public' => isset($is_public) && $is_public, - )) ?> - - - - render('comment/create', array( - 'skip_cancel' => true, - 'values' => array( - 'user_id' => $this->user->getId(), - 'task_id' => $task['id'], - ), - 'errors' => array(), - 'task' => $task, - )) ?> - -
- \ No newline at end of file diff --git a/app/Template/task/description.php b/app/Template/task/description.php index b84e9f42..9ffe8589 100644 --- a/app/Template/task/description.php +++ b/app/Template/task/description.php @@ -1,16 +1,9 @@ - -
- - -
+
+
+

+
+
+
text->markdown( $task['description'], @@ -36,4 +29,4 @@
- \ No newline at end of file +
\ No newline at end of file diff --git a/app/Template/task/details.php b/app/Template/task/details.php index 61f6c848..a7c4ad01 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -32,6 +32,13 @@ url->link(t('Public link'), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token']), false, '', '', true) ?> + +
  • + + url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?> +
  • + +
  • diff --git a/app/Template/task/public.php b/app/Template/task/public.php index 0052214a..723882c3 100644 --- a/app/Template/task/public.php +++ b/app/Template/task/public.php @@ -1,9 +1,6 @@
    - render('task/details', array('task' => $task, 'project' => $project, 'editable' => false)) ?> -

    url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?>

    - render('task/description', array( 'task' => $task, 'project' => $project, @@ -24,12 +21,11 @@ 'is_public' => true, )) ?> - render('task/comments', array( + render('comments/show', array( 'task' => $task, 'comments' => $comments, 'project' => $project, 'editable' => false, 'is_public' => true, )) ?> - -
    \ No newline at end of file + diff --git a/app/Template/task/show.php b/app/Template/task/show.php index 5dc27ca1..98221bcf 100644 --- a/app/Template/task/show.php +++ b/app/Template/task/show.php @@ -7,11 +7,9 @@ )) ?> hook->render('template:task:show:before-description', array('task' => $task, 'project' => $project)) ?> - render('task/description', array('task' => $task)) ?> hook->render('template:task:show:before-subtasks', array('task' => $task, 'project' => $project)) ?> - render('subtask/show', array( 'task' => $task, 'subtasks' => $subtasks, @@ -20,23 +18,24 @@ 'editable' => true, )) ?> -hook->render('template:task:show:before-tasklinks', array('task' => $task, 'project' => $project)) ?> - +hook->render('template:task:show:before-internal-links', array('task' => $task, 'project' => $project)) ?> render('tasklink/show', array( 'task' => $task, - 'links' => $links, + 'links' => $internal_links, 'project' => $project, 'link_label_list' => $link_label_list, 'editable' => true, 'is_public' => false, )) ?> -hook->render('template:task:show:before-timetracking', array('task' => $task, 'project' => $project)) ?> - -render('task/time_tracking_summary', array('task' => $task)) ?> +hook->render('template:task:show:before-external-links', array('task' => $task, 'project' => $project)) ?> +render('task_external_link/show', array( + 'task' => $task, + 'links' => $external_links, + 'project' => $project, +)) ?> hook->render('template:task:show:before-attachements', array('task' => $task, 'project' => $project)) ?> - render('task_file/show', array( 'task' => $task, 'files' => $files, @@ -44,8 +43,7 @@ )) ?> hook->render('template:task:show:before-comments', array('task' => $task, 'project' => $project)) ?> - -render('task/comments', array( +render('comments/show', array( 'task' => $task, 'comments' => $comments, 'project' => $project, diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php index e9af71a5..955b17c4 100644 --- a/app/Template/task/sidebar.php +++ b/app/Template/task/sidebar.php @@ -23,18 +23,6 @@ url->link(t('Time tracking'), 'task', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> -
  • app->checkMenuSelection('subtask', 'show') ?>> - - url->link(t('Sub-tasks'), 'subtask', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> -
  • -
  • app->checkMenuSelection('tasklink', 'show') ?>> - - url->link(t('Internal links'), 'tasklink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> -
  • -
  • app->checkMenuSelection('TaskExternalLink', 'show') ?>> - - url->link(t('External links'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> -