diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-03-18 21:00:14 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-03-18 21:00:14 -0400 |
commit | 854457baf0043b51ce9c30f36a6fecaed97cb04d (patch) | |
tree | 0f73023f63654ee7313ac79e83d9d19e58658a1a /app | |
parent | 68fba8fb64afe00aedccdf72f25d79b26356f2ab (diff) |
Improve task summary sections
Diffstat (limited to 'app')
-rw-r--r-- | app/Controller/Subtask.php | 17 | ||||
-rw-r--r-- | app/Controller/Task.php | 3 | ||||
-rw-r--r-- | app/Controller/TaskExternalLink.php | 22 | ||||
-rw-r--r-- | app/Controller/Tasklink.php | 21 | ||||
-rw-r--r-- | app/Template/comment/create.php | 10 | ||||
-rw-r--r-- | app/Template/comments/create.php | 36 | ||||
-rw-r--r-- | app/Template/comments/show.php | 31 | ||||
-rw-r--r-- | app/Template/subtask/show.php | 44 | ||||
-rw-r--r-- | app/Template/subtask/table.php | 2 | ||||
-rw-r--r-- | app/Template/task/comments.php | 35 | ||||
-rw-r--r-- | app/Template/task/description.php | 21 | ||||
-rw-r--r-- | app/Template/task/details.php | 7 | ||||
-rw-r--r-- | app/Template/task/public.php | 8 | ||||
-rw-r--r-- | app/Template/task/show.php | 20 | ||||
-rw-r--r-- | app/Template/task/sidebar.php | 20 | ||||
-rw-r--r-- | app/Template/task_external_link/show.php | 72 | ||||
-rw-r--r-- | app/Template/task_external_link/table.php | 42 | ||||
-rw-r--r-- | app/Template/task_file/files.php | 47 | ||||
-rw-r--r-- | app/Template/task_file/images.php | 34 | ||||
-rw-r--r-- | app/Template/task_file/show.php | 97 | ||||
-rw-r--r-- | app/Template/tasklink/show.php | 55 | ||||
-rw-r--r-- | app/Template/tasklink/table.php | 4 |
22 files changed, 278 insertions, 370 deletions
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 @@ -11,23 +11,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 * * @access public 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 @@ -13,22 +13,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 * * @access public @@ -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 @@ -29,27 +29,6 @@ class Tasklink extends Base } /** - * 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 * * @access public 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 @@ <div class="page-header"> <h2><?= t('Add a comment') ?></h2> </div> -<form class="popover-form" method="post" action="<?= $this->url->href('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off" class="form-comment"> +<form class="popover-form" method="post" action="<?= $this->url->href('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <?= $this->form->csrf() ?> <?= $this->form->hidden('task_id', $values) ?> <?= $this->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 @@ <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> - <?php if (! isset($skip_cancel)): ?> - <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> - <?php endif ?> + <?= t('or') ?> + <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> </div> </form> 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 method="post" action="<?= $this->url->href('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> + <?= $this->form->csrf() ?> + <?= $this->form->hidden('task_id', $values) ?> + <?= $this->form->hidden('user_id', $values) ?> + + <div class="form-tabs"> + <ul class="form-tabs-nav"> + <li class="form-tab form-tab-selected"> + <i class="fa fa-pencil-square-o fa-fw"></i><a id="markdown-write" href="#"><?= t('Write') ?></a> + </li> + <li class="form-tab"> + <a id="markdown-preview" href="#"><i class="fa fa-eye fa-fw"></i><?= t('Preview') ?></a> + </li> + </ul> + <div class="write-area"> + <?= $this->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' + ) ?> + </div> + <div class="preview-area"> + <div class="markdown"></div> + </div> + </div> + + <div class="form-actions"> + <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> + </div> +</form> 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 @@ +<section class="accordion-section <?= empty($comments) ? 'accordion-collapsed' : '' ?>"> + <div class="accordion-title"> + <h3><a href="#" class="fa accordion-toggle"></a> <?= t('Comments') ?></h3> + </div> + <div class="accordion-content" id="comments"> + <div class="comment-sorting"> + <i class="fa fa-sort"></i> + <?= $this->url->link(t('change sorting'), 'comment', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + </div> + <?php foreach ($comments as $comment): ?> + <?= $this->render('comment/show', array( + 'comment' => $comment, + 'task' => $task, + 'project' => $project, + 'editable' => $editable, + 'is_public' => isset($is_public) && $is_public, + )) ?> + <?php endforeach ?> + + <?php if ($editable): ?> + <?= $this->render('comments/create', array( + 'values' => array( + 'user_id' => $this->user->getId(), + 'task_id' => $task['id'], + ), + 'errors' => array(), + 'task' => $task, + )) ?> + <?php endif ?> + </div> +</section>
\ 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 @@ -<?php if (isset($show_title)): ?> -<div class="task-show-title color-<?= $task['color_id'] ?>"> - <h2><?= $this->text->e($task['title']) ?></h2> -</div> -<?php endif ?> - -<div class="page-header"> - <h2><?= t('Sub-Tasks') ?></h2> - <ul> - <li> - <i class="fa fa-plus fa-fw"></i> - <?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> - </li> - </ul> -</div> - -<div id="subtasks"> - - <?= $this->render('subtask/table', array('subtasks' => $subtasks, 'task' => $task, 'editable' => $editable)) ?> - - <?php if ($editable && $this->user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?> - <form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> - <?= $this->form->csrf() ?> - <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?> - <?= $this->form->text('title', array(), array(), array('required', 'placeholder="'.t('Type here to create a new sub-task').'"')) ?> - <?= $this->form->numeric('time_estimated', array(), array(), array('placeholder="'.t('Original estimate').'"')) ?> - <?= $this->form->select('user_id', $users_list, array(), array(), array('placeholder="'.t('Assignee').'"')) ?> - <button type="submit" class="btn btn-blue"><?= t('Add') ?></button> - </form> - <?php endif ?> - -</div> +<section class="accordion-section <?= empty($subtasks) ? 'accordion-collapsed' : '' ?>"> + <div class="accordion-title"> + <h3><a href="#" class="fa accordion-toggle"></a> <?= t('Sub-Tasks') ?></h3> + </div> + <div class="accordion-content"> + <?= $this->render('subtask/table', array( + 'subtasks' => $subtasks, + 'task' => $task, + 'editable' => $editable + )) ?> + </div> +</section> 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 @@ <?php endforeach ?> </tbody> </table> -<?php else: ?> - <p class="alert"><?= t('There is no subtask at the moment.') ?></p> <?php endif ?> 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 @@ -<?php if (! empty($comments)): ?> -<div id="comments" class="task-show-section"> - <div class="page-header"> - <h2> - <?= t('Comments') ?> - <span class="comment-sorting"> - <i class="fa fa-sort"></i> - <?= $this->url->link(t('change sorting'), 'comment', 'toggleSorting', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> - </span> - </h2> - </div> - - <?php foreach ($comments as $comment): ?> - <?= $this->render('comment/show', array( - 'comment' => $comment, - 'task' => $task, - 'project' => $project, - 'editable' => $editable, - 'is_public' => isset($is_public) && $is_public, - )) ?> - <?php endforeach ?> - - <?php if ($editable): ?> - <?= $this->render('comment/create', array( - 'skip_cancel' => true, - 'values' => array( - 'user_id' => $this->user->getId(), - 'task_id' => $task['id'], - ), - 'errors' => array(), - 'task' => $task, - )) ?> - <?php endif ?> -</div> -<?php endif ?>
\ 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 @@ -<?php if (! empty($task['description'])): ?> - <div id="description" class="task-show-section"> - <div class="page-header"> - <h2><?= t('Description') ?></h2> - <ul> - <li> - <i class="fa fa-edit fa-fw"></i> - <?= $this->url->link(t('Edit the description'), 'taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> - </li> - </ul> - </div> - - <article class="markdown task-show-description"> +<section class="accordion-section <?= empty($task['description']) ? 'accordion-collapsed' : '' ?>"> + <div class="accordion-title"> + <h3><a href="#" class="fa accordion-toggle"></a> <?= t('Description') ?></h3> + </div> + <div class="accordion-content"> + <article class="markdown"> <?php if (! isset($is_public)): ?> <?= $this->text->markdown( $task['description'], @@ -36,4 +29,4 @@ <?php endif ?> </article> </div> -<?php endif ?>
\ No newline at end of file +</section>
\ 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 @@ <?= $this->url->link(t('Public link'), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token']), false, '', '', true) ?> </li> <?php endif ?> + <?php if ($project['is_public'] && !$editable): ?> + <li class="smaller"> + <i class="fa fa-th fa-fw"></i> + <?= $this->url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?> + </li> + <?php endif ?> + <li class="smaller"> </ul> </div> <div class="task-summary-column"> 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 @@ <section id="main" class="public-task"> - <?= $this->render('task/details', array('task' => $task, 'project' => $project, 'editable' => false)) ?> - <p class="pull-right"><?= $this->url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?></p> - <?= $this->render('task/description', array( 'task' => $task, 'project' => $project, @@ -24,12 +21,11 @@ 'is_public' => true, )) ?> - <?= $this->render('task/comments', array( + <?= $this->render('comments/show', array( 'task' => $task, 'comments' => $comments, 'project' => $project, 'editable' => false, 'is_public' => true, )) ?> - -</section>
\ No newline at end of file +</section> 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 @@ )) ?> <?= $this->hook->render('template:task:show:before-description', array('task' => $task, 'project' => $project)) ?> - <?= $this->render('task/description', array('task' => $task)) ?> <?= $this->hook->render('template:task:show:before-subtasks', array('task' => $task, 'project' => $project)) ?> - <?= $this->render('subtask/show', array( 'task' => $task, 'subtasks' => $subtasks, @@ -20,23 +18,24 @@ 'editable' => true, )) ?> -<?= $this->hook->render('template:task:show:before-tasklinks', array('task' => $task, 'project' => $project)) ?> - +<?= $this->hook->render('template:task:show:before-internal-links', array('task' => $task, 'project' => $project)) ?> <?= $this->render('tasklink/show', array( 'task' => $task, - 'links' => $links, + 'links' => $internal_links, 'project' => $project, 'link_label_list' => $link_label_list, 'editable' => true, 'is_public' => false, )) ?> -<?= $this->hook->render('template:task:show:before-timetracking', array('task' => $task, 'project' => $project)) ?> - -<?= $this->render('task/time_tracking_summary', array('task' => $task)) ?> +<?= $this->hook->render('template:task:show:before-external-links', array('task' => $task, 'project' => $project)) ?> +<?= $this->render('task_external_link/show', array( + 'task' => $task, + 'links' => $external_links, + 'project' => $project, +)) ?> <?= $this->hook->render('template:task:show:before-attachements', array('task' => $task, 'project' => $project)) ?> - <?= $this->render('task_file/show', array( 'task' => $task, 'files' => $files, @@ -44,8 +43,7 @@ )) ?> <?= $this->hook->render('template:task:show:before-comments', array('task' => $task, 'project' => $project)) ?> - -<?= $this->render('task/comments', array( +<?= $this->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 @@ <?= $this->url->link(t('Time tracking'), 'task', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> </li> <?php endif ?> - <li <?= $this->app->checkMenuSelection('subtask', 'show') ?>> - <i class="fa fa-tasks fa-fw"></i> - <?= $this->url->link(t('Sub-tasks'), 'subtask', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> - </li> - <li <?= $this->app->checkMenuSelection('tasklink', 'show') ?>> - <i class="fa fa-code-fork fa-fw"></i> - <?= $this->url->link(t('Internal links'), 'tasklink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> - </li> - <li <?= $this->app->checkMenuSelection('TaskExternalLink', 'show') ?>> - <i class="fa fa-external-link fa-fw"></i> - <?= $this->url->link(t('External links'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> - </li> </ul> <h2><?= t('Actions') ?></h2> <ul> @@ -55,6 +43,14 @@ <?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> <li> + <i class="fa fa-code-fork fa-fw"></i> + <?= $this->url->link(t('Add internal link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + </li> + <li> + <i class="fa fa-external-link fa-fw"></i> + <?= $this->url->link(t('Add external link'), 'TaskExternalLink', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + </li> + <li> <i class="fa fa-comment-o fa-fw"></i> <?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> </li> diff --git a/app/Template/task_external_link/show.php b/app/Template/task_external_link/show.php index e9339e86..8ed11803 100644 --- a/app/Template/task_external_link/show.php +++ b/app/Template/task_external_link/show.php @@ -1,60 +1,12 @@ -<div class="task-show-title color-<?= $task['color_id'] ?>"> - <h2><?= $this->text->e($task['title']) ?></h2> -</div> - -<div class="page-header"> - <h2><?= t('External links') ?></h2> - <ul> - <li> - <i class="fa fa-external-link fa-fw"></i> - <?= $this->url->link(t('Add external link'), 'TaskExternalLink', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> - </li> - </ul> -</div> - -<?php if (empty($links)): ?> - <p class="alert"><?= t('There is no external link for the moment.') ?></p> -<?php else: ?> - <table class="table-stripped table-small"> - <tr> - <th class="column-10"><?= t('Type') ?></th> - <th><?= t('Title') ?></th> - <th class="column-10"><?= t('Dependency') ?></th> - <th class="column-15"><?= t('Creator') ?></th> - <th class="column-15"><?= t('Date') ?></th> - <?php if ($this->user->hasProjectAccess('TaskExternalLink', 'edit', $task['project_id'])): ?> - <th class="column-5"><?= t('Action') ?></th> - <?php endif ?> - </tr> - <?php foreach ($links as $link): ?> - <tr> - <td> - <?= $link['type'] ?> - </td> - <td> - <a href="<?= $link['url'] ?>" target="_blank"><?= $this->text->e($link['title']) ?></a> - </td> - <td> - <?= $this->text->e($link['dependency_label']) ?> - </td> - <td> - <?= $this->text->e($link['creator_name'] ?: $link['creator_username']) ?> - </td> - <td> - <?= $this->dt->date($link['date_creation']) ?> - </td> - <?php if ($this->user->hasProjectAccess('TaskExternalLink', 'edit', $task['project_id'])): ?> - <td> - <div class="dropdown"> - <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> - <ul> - <li><?= $this->url->link(t('Edit'), 'TaskExternalLink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> - <li><?= $this->url->link(t('Remove'), 'TaskExternalLink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> - </ul> - </div> - </td> - <?php endif ?> - </tr> - <?php endforeach ?> - </table> -<?php endif ?> +<section class="accordion-section <?= empty($links) ? 'accordion-collapsed' : '' ?>"> + <div class="accordion-title"> + <h3><a href="#" class="fa accordion-toggle"></a> <?= t('External links') ?></h3> + </div> + <div class="accordion-content"> + <?= $this->render('task_external_link/table', array( + 'links' => $links, + 'task' => $task, + 'project' => $project, + )) ?> + </div> +</section> diff --git a/app/Template/task_external_link/table.php b/app/Template/task_external_link/table.php new file mode 100644 index 00000000..d1cdeca1 --- /dev/null +++ b/app/Template/task_external_link/table.php @@ -0,0 +1,42 @@ +<table class="table-stripped table-small"> + <tr> + <th class="column-10"><?= t('Type') ?></th> + <th><?= t('Title') ?></th> + <th class="column-10"><?= t('Dependency') ?></th> + <th class="column-15"><?= t('Creator') ?></th> + <th class="column-15"><?= t('Date') ?></th> + <?php if ($this->user->hasProjectAccess('TaskExternalLink', 'edit', $task['project_id'])): ?> + <th class="column-5"><?= t('Action') ?></th> + <?php endif ?> + </tr> + <?php foreach ($links as $link): ?> + <tr> + <td> + <?= $link['type'] ?> + </td> + <td> + <a href="<?= $link['url'] ?>" target="_blank"><?= $this->text->e($link['title']) ?></a> + </td> + <td> + <?= $this->text->e($link['dependency_label']) ?> + </td> + <td> + <?= $this->text->e($link['creator_name'] ?: $link['creator_username']) ?> + </td> + <td> + <?= $this->dt->date($link['date_creation']) ?> + </td> + <?php if ($this->user->hasProjectAccess('TaskExternalLink', 'edit', $task['project_id'])): ?> + <td> + <div class="dropdown"> + <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> + <ul> + <li><?= $this->url->link(t('Edit'), 'TaskExternalLink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> + <li><?= $this->url->link(t('Remove'), 'TaskExternalLink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> + </ul> + </div> + </td> + <?php endif ?> + </tr> + <?php endforeach ?> +</table>
\ No newline at end of file diff --git a/app/Template/task_file/files.php b/app/Template/task_file/files.php new file mode 100644 index 00000000..5603014e --- /dev/null +++ b/app/Template/task_file/files.php @@ -0,0 +1,47 @@ +<?php if (! empty($files)): ?> + <table class="table-stripped table-small"> + <tr> + <th><?= t('Filename') ?></th> + <th><?= t('Creator') ?></th> + <th><?= t('Date') ?></th> + <th><?= t('Size') ?></th> + </tr> + <?php foreach ($files as $file): ?> + <tr> + <td> + <i class="fa <?= $this->file->icon($file['name']) ?> fa-fw"></i> + <div class="dropdown"> + <a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->text->e($file['name']) ?> <i class="fa fa-caret-down"></i></a> + <ul> + <?php if ($this->file->getPreviewType($file['name']) !== null): ?> + <li> + <i class="fa fa-eye fa-fw"></i> + <?= $this->url->link(t('View file'), 'FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + </li> + <?php endif ?> + <li> + <i class="fa fa-download fa-fw"></i> + <?= $this->url->link(t('Download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + </li> + <?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?> + <li> + <i class="fa fa-trash fa-fw"></i> + <?= $this->url->link(t('Remove'), 'TaskFile', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + </li> + <?php endif ?> + </ul> + </div> + </td> + <td> + <?= $this->text->e($file['user_name'] ?: $file['username']) ?> + </td> + <td> + <?= $this->dt->date($file['date']) ?> + </td> + <td> + <?= $this->text->bytes($file['size']) ?> + </td> + </tr> + <?php endforeach ?> + </table> +<?php endif ?>
\ No newline at end of file diff --git a/app/Template/task_file/images.php b/app/Template/task_file/images.php new file mode 100644 index 00000000..55c098cb --- /dev/null +++ b/app/Template/task_file/images.php @@ -0,0 +1,34 @@ +<?php if (! empty($images)): ?> + <div class="file-thumbnails"> + <?php foreach ($images as $file): ?> + <div class="file-thumbnail"> + <a href="<?= $this->url->href('FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewer', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->text->e($file['name']) ?>" alt="<?= $this->text->e($file['name']) ?>"></a> + <div class="file-thumbnail-content"> + <div class="file-thumbnail-title"> + <div class="dropdown"> + <a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->text->e($file['name']) ?> <i class="fa fa-caret-down"></i></a> + <ul> + <li> + <i class="fa fa-download fa-fw"></i> + <?= $this->url->link(t('Download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + </li> + <?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?> + <li> + <i class="fa fa-trash fa-fw"></i> + <?= $this->url->link(t('Remove'), 'TaskFile', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + </li> + <?php endif ?> + </ul> + </div> + </div> + <div class="file-thumbnail-description"> + <span class="tooltip" title='<?= t('Uploaded: %s', $this->dt->datetime($file['date'])).'<br>'.t('Size: %s', $this->text->bytes($file['size'])) ?>'> + <i class="fa fa-info-circle"></i> + </span> + <?= t('Uploaded by %s', $file['user_name'] ?: $file['username']) ?> + </div> + </div> + </div> + <?php endforeach ?> + </div> +<?php endif ?>
\ No newline at end of file diff --git a/app/Template/task_file/show.php b/app/Template/task_file/show.php index 21bf79ef..df69605d 100644 --- a/app/Template/task_file/show.php +++ b/app/Template/task_file/show.php @@ -1,90 +1,9 @@ -<?php if (! empty($files) || ! empty($images)): ?> -<div id="attachments" class="task-show-section"> - - <div class="page-header"> - <h2><?= t('Attachments') ?></h2> +<section class="accordion-section <?= empty($files) && empty($images) ? 'accordion-collapsed' : '' ?>"> + <div class="accordion-title"> + <h3><a href="#" class="fa accordion-toggle"></a> <?= t('Attachments') ?></h3> </div> - <?php if (! empty($images)): ?> - <div class="file-thumbnails"> - <?php foreach ($images as $file): ?> - <div class="file-thumbnail"> - <a href="<?= $this->url->href('FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewer', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->text->e($file['name']) ?>" alt="<?= $this->text->e($file['name']) ?>"></a> - <div class="file-thumbnail-content"> - <div class="file-thumbnail-title"> - <div class="dropdown"> - <a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->text->e($file['name']) ?> <i class="fa fa-caret-down"></i></a> - <ul> - <li> - <i class="fa fa-download fa-fw"></i> - <?= $this->url->link(t('Download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> - </li> - <?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?> - <li> - <i class="fa fa-trash fa-fw"></i> - <?= $this->url->link(t('Remove'), 'TaskFile', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> - </li> - <?php endif ?> - </ul> - </div> - </div> - <div class="file-thumbnail-description"> - <span class="tooltip" title='<?= t('Uploaded: %s', $this->dt->datetime($file['date'])).'<br>'.t('Size: %s', $this->text->bytes($file['size'])) ?>'> - <i class="fa fa-info-circle"></i> - </span> - <?= t('Uploaded by %s', $file['user_name'] ?: $file['username']) ?> - </div> - </div> - </div> - <?php endforeach ?> - </div> - <?php endif ?> - - <?php if (! empty($files)): ?> - <table class="table-stripped"> - <tr> - <th><?= t('Filename') ?></th> - <th><?= t('Creator') ?></th> - <th><?= t('Date') ?></th> - <th><?= t('Size') ?></th> - </tr> - <?php foreach ($files as $file): ?> - <tr> - <td> - <i class="fa <?= $this->file->icon($file['name']) ?> fa-fw"></i> - <div class="dropdown"> - <a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->text->e($file['name']) ?> <i class="fa fa-caret-down"></i></a> - <ul> - <?php if ($this->file->getPreviewType($file['name']) !== null): ?> - <li> - <i class="fa fa-eye fa-fw"></i> - <?= $this->url->link(t('View file'), 'FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> - </li> - <?php endif ?> - <li> - <i class="fa fa-download fa-fw"></i> - <?= $this->url->link(t('Download'), 'FileViewer', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> - </li> - <?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?> - <li> - <i class="fa fa-trash fa-fw"></i> - <?= $this->url->link(t('Remove'), 'TaskFile', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> - </li> - <?php endif ?> - </ul> - </div> - </td> - <td> - <?= $this->text->e($file['user_name'] ?: $file['username']) ?> - </td> - <td> - <?= $this->dt->date($file['date']) ?> - </td> - <td> - <?= $this->text->bytes($file['size']) ?> - </td> - </tr> - <?php endforeach ?> - </table> - <?php endif ?> -</div> -<?php endif ?>
\ No newline at end of file + <div class="accordion-content"> + <?= $this->render('task_file/images', array('task' => $task, 'images' => $images)) ?> + <?= $this->render('task_file/files', array('task' => $task, 'files' => $files)) ?> + </div> +</section> diff --git a/app/Template/tasklink/show.php b/app/Template/tasklink/show.php index b2ef93d7..9f718fc9 100644 --- a/app/Template/tasklink/show.php +++ b/app/Template/tasklink/show.php @@ -1,43 +1,14 @@ -<?php if (isset($show_title)): ?> - <div class="task-show-title color-<?= $task['color_id'] ?>"> - <h2><?= $this->text->e($task['title']) ?></h2> +<section class="accordion-section <?= empty($links) ? 'accordion-collapsed' : '' ?>"> + <div class="accordion-title"> + <h3><a href="#" class="fa accordion-toggle"></a> <?= t('Internal links') ?></h3> </div> -<?php endif ?> - -<div class="page-header"> - <h2><?= t('Internal links') ?></h2> - <ul> - <li> - <i class="fa fa-code-fork fa-fw"></i> - <?= $this->url->link(t('Add internal link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> - </li> - </ul> -</div> - -<div id="link"> - - <?= $this->render('tasklink/table', array('links' => $links, 'task' => $task, 'project' => $project, 'editable' => $editable, 'is_public' => $is_public)) ?> - - <?php if ($editable && isset($link_label_list)): ?> - <form action="<?= $this->url->href('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off"> - <?= $this->form->csrf() ?> - <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?> - <?= $this->form->hidden('opposite_task_id', array()) ?> - <?= $this->form->select('link_id', $link_label_list, array(), array()) ?> - <?= $this->form->text( - 'title', - array(), - array(), - array( - 'required', - 'placeholder="'.t('Start to type task title...').'"', - 'title="'.t('Start to type task title...').'"', - 'data-dst-field="opposite_task_id"', - 'data-search-url="'.$this->url->href('TaskHelper', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', - ), - 'autocomplete') ?> - <input type="submit" value="<?= t('Add') ?>" class="btn btn-blue"/> - </form> - <?php endif ?> - -</div> + <div class="accordion-content"> + <?= $this->render('tasklink/table', array( + 'links' => $links, + 'task' => $task, + 'project' => $project, + 'editable' => $editable, + 'is_public' => $is_public, + )) ?> + </div> +</section> diff --git a/app/Template/tasklink/table.php b/app/Template/tasklink/table.php index 62531cc7..df7bc4f5 100644 --- a/app/Template/tasklink/table.php +++ b/app/Template/tasklink/table.php @@ -1,6 +1,4 @@ -<?php if (empty($links)): ?> - <p class="alert"><?= t('There is no internal link for the moment.') ?></p> -<?php else: ?> +<?php if (! empty($links)): ?> <table class="task-links-table table-stripped"> <?php foreach ($links as $label => $grouped_links): ?> <?php $hide_td = false ?> |