diff options
| author | Frederic Guillot <fred@kanboard.net> | 2017-02-11 17:22:10 -0500 |
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2017-02-11 17:22:10 -0500 |
| commit | 8bf054a480ecc2d31b857cb27bd6256f1efdd74c (patch) | |
| tree | 390065e6c102bc3e8d5dcf5b5e6d7174e5b26da2 /app/Controller/CommentListController.php | |
| parent | 28052edb22cb0a65d3ad81c7654a0673de82e1ac (diff) | |
Open comments in board view with a modal dialog instead of tooltip
Diffstat (limited to 'app/Controller/CommentListController.php')
| -rw-r--r-- | app/Controller/CommentListController.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/app/Controller/CommentListController.php b/app/Controller/CommentListController.php new file mode 100644 index 00000000..63d20663 --- /dev/null +++ b/app/Controller/CommentListController.php @@ -0,0 +1,50 @@ +<?php + +namespace Kanboard\Controller; + +use Kanboard\Model\UserMetadataModel; + +/** + * Class CommentListController + * + * @package Kanboard\Controller + * @author Frederic Guillot + */ +class CommentListController extends BaseController +{ + public function show() + { + $project = $this->getProject(); + $task = $this->getTask(); + $commentSortingDirection = $this->userMetadataCacheDecorator->get(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, 'ASC'); + + $this->response->html($this->template->render('comment_list/show', array( + 'project' => $project, + 'task' => $task, + 'comments' => $this->commentModel->getAll($task['id'], $commentSortingDirection), + 'editable' => $this->helper->user->hasProjectAccess('CommentController', 'edit', $task['project_id']), + ))); + } + + public function save() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + $values['task_id'] = $task['id']; + $values['user_id'] = $this->userSession->getId(); + + list($valid, ) = $this->commentValidator->validateCreation($values); + + if ($valid && $this->commentModel->create($values) !== false) { + $this->flash->success(t('Comment added successfully.')); + } + + $this->show(); + } + + public function toggleSorting() + { + $this->helper->comment->toggleSorting(); + $this->show(); + } +} |
