diff options
25 files changed, 581 insertions, 536 deletions
diff --git a/app/Controller/App.php b/app/Controller/App.php index 64f9461f..b7f79b1d 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -2,7 +2,7 @@ namespace Controller; -use Model\Project; +use Model\Project as ProjectModel; /** * Application controller @@ -19,7 +19,7 @@ class App extends Base */ public function index() { - if ($this->project->countByStatus(Project::ACTIVE)) { + if ($this->project->countByStatus(ProjectModel::ACTIVE)) { $this->response->redirect('?controller=board'); } else { diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 183b9395..f8e7914b 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -11,6 +11,20 @@ use Model\LastLogin; * * @package controller * @author Frederic Guillot + * @property \Model\Acl $acl + * @property \Model\Action $action + * @property \Model\Board $board + * @property \Model\Category $category + * @property \Model\Comment $comment + * @property \Model\Config $config + * @property \Model\File $file + * @property \Model\Google $google + * @property \Model\LastLogin $lastlogin + * @property \Model\Ldap $ldap + * @property \Model\Project $project + * @property \Model\RememberMe $rememberme + * @property \Model\Task $task + * @property \Model\User $user */ abstract class Base { @@ -173,67 +187,36 @@ abstract class Base } /** - * Display the template show task (common between different actions) + * Common layout for task views * * @access protected - * @param array $task Task data - * @param array $comment_form Comment form data - * @param array $description_form Description form data - * @param array $comment_edit_form Comment edit form data + * @param string $template Template name + * @param array $params Template parameters */ - protected function showTask(array $task, array $comment_form = array(), array $description_form = array(), array $comment_edit_form = array()) + protected function taskLayout($template, array $params) { - if (empty($comment_form)) { - $comment_form = array( - 'values' => array('task_id' => $task['id'], 'user_id' => $this->acl->getUserId()), - 'errors' => array() - ); - } - - if (empty($description_form)) { - $description_form = array( - 'values' => array('id' => $task['id']), - 'errors' => array() - ); - } - - if (empty($comment_edit_form)) { - $comment_edit_form = array( - 'values' => array('id' => 0), - 'errors' => array() - ); - } - else { - $hide_comment_form = true; - } + $content = $this->template->load($template, $params); + $params['task_content_for_layout'] = $content; - $this->response->html($this->taskLayout('task_show', array( - 'hide_comment_form' => isset($hide_comment_form), - 'comment_edit_form' => $comment_edit_form, - 'comment_form' => $comment_form, - 'description_form' => $description_form, - 'comments' => $this->comment->getAll($task['id']), - 'task' => $task, - 'columns_list' => $this->board->getColumnsList($task['project_id']), - 'colors_list' => $this->task->getColors(), - 'files' => $this->file->getAll($task['id']), - 'menu' => 'tasks', - 'title' => $task['title'], - ))); + return $this->template->layout('task_layout', $params); } /** - * Common layout for task views + * Common method to get a task for task views * * @access protected - * @param string $template Template name - * @param array $params Template parameters + * @return array */ - protected function taskLayout($template, array $params) + protected function getTask() { - $content = $this->template->load($template, $params); - $params['task_content_for_layout'] = $content; + $task = $this->task->getById($this->request->getIntegerParam('task_id'), true); - return $this->template->layout('task_layout', $params); + if (! $task) { + $this->notfound(); + } + + $this->checkProjectPermissions($task['project_id']); + + return $task; } } diff --git a/app/Controller/Board.php b/app/Controller/Board.php index c727a422..4cf0d381 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -2,8 +2,8 @@ namespace Controller; -use Model\Project; -use Model\User; +use Model\Project as ProjectModel; +use Model\User as UserModel; /** * Board controller @@ -52,7 +52,7 @@ class Board extends Base { $task = $this->task->getById($this->request->getIntegerParam('task_id')); $project = $this->project->getById($task['project_id']); - $projects = $this->project->getListByStatus(Project::ACTIVE); + $projects = $this->project->getListByStatus(ProjectModel::ACTIVE); if ($this->acl->isRegularUser()) { $projects = $this->project->filterListByAccess($projects, $this->acl->getUserId()); @@ -143,7 +143,7 @@ class Board extends Base */ public function index() { - $projects = $this->project->getListByStatus(Project::ACTIVE); + $projects = $this->project->getListByStatus(ProjectModel::ACTIVE); if ($this->acl->isRegularUser()) { $projects = $this->project->filterListByAccess($projects, $this->acl->getUserId()); @@ -177,10 +177,10 @@ class Board extends Base public function show() { $project_id = $this->request->getIntegerParam('project_id'); - $user_id = $this->request->getIntegerParam('user_id', User::EVERYBODY_ID); + $user_id = $this->request->getIntegerParam('user_id', UserModel::EVERYBODY_ID); $this->checkProjectPermissions($project_id); - $projects = $this->project->getListByStatus(Project::ACTIVE); + $projects = $this->project->getListByStatus(ProjectModel::ACTIVE); if ($this->acl->isRegularUser()) { $projects = $this->project->filterListByAccess($projects, $this->acl->getUserId()); diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index c9f226f7..47eaf6b6 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -11,6 +11,27 @@ namespace Controller; class Comment extends Base { /** + * Get the current comment + * + * @access private + * @return array + */ + private function getComment() + { + $comment = $this->comment->getById($this->request->getIntegerParam('comment_id')); + + if (! $comment) { + $this->notfound(); + } + + if (! $this->acl->isAdminUser() && $comment['user_id'] != $this->acl->getUserId()) { + $this->forbidden(); + } + + return $comment; + } + + /** * Forbidden page for comments * * @access public @@ -24,18 +45,36 @@ class Comment extends Base } /** + * Add comment form + * + * @access public + */ + public function create() + { + $task = $this->getTask(); + + $this->response->html($this->taskLayout('comment_create', array( + 'values' => array( + 'user_id' => $this->acl->getUserId(), + 'task_id' => $task['id'], + ), + 'errors' => array(), + 'task' => $task, + 'menu' => 'tasks', + 'title' => t('Add a comment') + ))); + } + + /** * Add a comment * * @access public */ public function save() { - $task = $this->task->getById($this->request->getIntegerParam('task_id'), true); + $task = $this->getTask(); $values = $this->request->getValues(); - if (! $task) $this->notfound(); - $this->checkProjectPermissions($task['project_id']); - list($valid, $errors) = $this->comment->validateCreation($values); if ($valid) { @@ -47,13 +86,16 @@ class Comment extends Base $this->session->flashError(t('Unable to create your comment.')); } - $this->response->redirect('?controller=task&action=show&task_id='.$task['id']); + $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#comments'); } - $this->showTask( - $task, - array('values' => $values, 'errors' => $errors) - ); + $this->response->html($this->taskLayout('comment_create', array( + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + 'menu' => 'tasks', + 'title' => t('Add a comment') + ))); } /** @@ -63,26 +105,17 @@ class Comment extends Base */ public function edit() { - $task_id = $this->request->getIntegerParam('task_id'); - $comment_id = $this->request->getIntegerParam('comment_id'); - - $task = $this->task->getById($task_id, true); - $comment = $this->comment->getById($comment_id); - - if (! $task || ! $comment) $this->notfound(); - $this->checkProjectPermissions($task['project_id']); - - if ($this->acl->isAdminUser() || $comment['user_id'] == $this->acl->getUserId()) { - - $this->showTask( - $task, - array(), - array(), - array('values' => array('id' => $comment['id']), 'errors' => array()) - ); - } - - $this->forbidden(); + $task = $this->getTask(); + $comment = $this->getComment(); + + $this->response->html($this->taskLayout('comment_edit', array( + 'values' => $comment, + 'errors' => array(), + 'comment' => $comment, + 'task' => $task, + 'menu' => 'tasks', + 'title' => t('Edit a comment') + ))); } /** @@ -92,42 +125,32 @@ class Comment extends Base */ public function update() { - $task_id = $this->request->getIntegerParam('task_id'); - $comment_id = $this->request->getIntegerParam('comment_id'); - - $task = $this->task->getById($task_id, true); - $comment = $this->comment->getById($comment_id); + $task = $this->getTask(); + $comment = $this->getComment(); $values = $this->request->getValues(); + list($valid, $errors) = $this->comment->validateModification($values); - if (! $task || ! $comment) $this->notfound(); - $this->checkProjectPermissions($task['project_id']); - - if ($this->acl->isAdminUser() || $comment['user_id'] == $this->acl->getUserId()) { - - list($valid, $errors) = $this->comment->validateModification($values); - - if ($valid) { - - if ($this->comment->update($values)) { - $this->session->flash(t('Comment updated successfully.')); - } - else { - $this->session->flashError(t('Unable to update your comment.')); - } + if ($valid) { - $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#comment-'.$comment_id); + if ($this->comment->update($values)) { + $this->session->flash(t('Comment updated successfully.')); + } + else { + $this->session->flashError(t('Unable to update your comment.')); } - $this->showTask( - $task, - array(), - array(), - array('values' => $values, 'errors' => $errors) - ); + $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#comment-'.$comment['id']); } - $this->forbidden(); + $this->response->html($this->taskLayout('comment_edit', array( + 'values' => $values, + 'errors' => $errors, + 'comment' => $comment, + 'task' => $task, + 'menu' => 'tasks', + 'title' => t('Edit a comment') + ))); } /** @@ -137,25 +160,15 @@ class Comment extends Base */ public function confirm() { - $project_id = $this->request->getIntegerParam('project_id'); - $comment_id = $this->request->getIntegerParam('comment_id'); + $task = $this->getTask(); + $comment = $this->getComment(); - $this->checkProjectPermissions($project_id); - - $comment = $this->comment->getById($comment_id); - if (! $comment) $this->notfound(); - - if ($this->acl->isAdminUser() || $comment['user_id'] == $this->acl->getUserId()) { - - $this->response->html($this->template->layout('comment_remove', array( - 'comment' => $comment, - 'project_id' => $project_id, - 'menu' => 'tasks', - 'title' => t('Remove a comment') - ))); - } - - $this->forbidden(); + $this->response->html($this->taskLayout('comment_remove', array( + 'comment' => $comment, + 'task' => $task, + 'menu' => 'tasks', + 'title' => t('Remove a comment') + ))); } /** @@ -165,25 +178,16 @@ class Comment extends Base */ public function remove() { - $project_id = $this->request->getIntegerParam('project_id'); - $comment_id = $this->request->getIntegerParam('comment_id'); + $task = $this->getTask(); + $comment = $this->getComment(); - $this->checkProjectPermissions($project_id); - - $comment = $this->comment->getById($comment_id); - if (! $comment) $this->notfound(); - - if ($this->acl->isAdminUser() || $comment['user_id'] == $this->acl->getUserId()) { - - if ($this->comment->remove($comment['id'])) { - $this->session->flash(t('Comment removed successfully.')); - } else { - $this->session->flashError(t('Unable to remove this comment.')); - } - - $this->response->redirect('?controller=task&action=show&task_id='.$comment['task_id']); + if ($this->comment->remove($comment['id'])) { + $this->session->flash(t('Comment removed successfully.')); + } + else { + $this->session->flashError(t('Unable to remove this comment.')); } - $this->forbidden(); + $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#comments'); } } diff --git a/app/Controller/File.php b/app/Controller/File.php new file mode 100644 index 00000000..1604ab13 --- /dev/null +++ b/app/Controller/File.php @@ -0,0 +1,136 @@ +<?php + +namespace Controller; + +use Model\File as FileModel; + +/** + * File controller + * + * @package controller + * @author Frederic Guillot + */ +class File extends Base +{ + /** + * File upload form + * + * @access public + */ + public function create() + { + $task = $this->getTask(); + + $this->response->html($this->taskLayout('file_new', array( + 'task' => $task, + 'menu' => 'tasks', + 'title' => t('Attach a document') + ))); + } + + /** + * File upload (save files) + * + * @access public + */ + public function save() + { + $task = $this->getTask(); + $this->file->upload($task['project_id'], $task['id'], 'files'); + $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#attachments'); + } + + /** + * File download + * + * @access public + */ + public function download() + { + $task = $this->getTask(); + $file = $this->file->getById($this->request->getIntegerParam('file_id')); + $filename = FileModel::BASE_PATH.$file['path']; + + if ($file['task_id'] == $task['id'] && file_exists($filename)) { + $this->response->forceDownload($file['name']); + $this->response->binary(file_get_contents($filename)); + } + + $this->response->redirect('?controller=task&action=show&task_id='.$task['id']); + } + + /** + * Open a file (show the content in a popover) + * + * @access public + */ + public function open() + { + $task = $this->getTask(); + $file = $this->file->getById($this->request->getIntegerParam('file_id')); + + if ($file['task_id'] == $task['id']) { + $this->response->html($this->template->load('file_open', array( + 'file' => $file + ))); + } + } + + /** + * Return the file content (work only for images) + * + * @access public + */ + public function image() + { + $task = $this->getTask(); + $file = $this->file->getById($this->request->getIntegerParam('file_id')); + $filename = FileModel::BASE_PATH.$file['path']; + + if ($file['task_id'] == $task['id'] && file_exists($filename)) { + $metadata = getimagesize($filename); + + if (isset($metadata['mime'])) { + $this->response->contentType($metadata['mime']); + readfile($filename); + } + } + } + + /** + * Remove a file + * + * @access public + */ + public function remove() + { + $task = $this->getTask(); + $file = $this->file->getById($this->request->getIntegerParam('file_id')); + + if ($file['task_id'] == $task['id'] && $this->file->remove($file['id'])) { + $this->session->flash(t('File removed successfully.')); + } else { + $this->session->flashError(t('Unable to remove this file.')); + } + + $this->response->redirect('?controller=task&action=show&task_id='.$task['id']); + } + + /** + * Confirmation dialog before removing a file + * + * @access public + */ + public function confirm() + { + $task = $this->getTask(); + $file = $this->file->getById($this->request->getIntegerParam('file_id')); + + $this->response->html($this->taskLayout('file_remove', array( + 'task' => $task, + 'file' => $file, + 'menu' => 'tasks', + 'title' => t('Remove a file') + ))); + } +} diff --git a/app/Controller/Project.php b/app/Controller/Project.php index 5cb244a2..e539f364 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -2,7 +2,7 @@ namespace Controller; -use Model\Task; +use Model\Task as TaskModel; /** * Project controller @@ -96,7 +96,7 @@ class Project extends Base $filters = array( array('column' => 'project_id', 'operator' => 'eq', 'value' => $project_id), - array('column' => 'is_active', 'operator' => 'eq', 'value' => Task::STATUS_CLOSED), + array('column' => 'is_active', 'operator' => 'eq', 'value' => TaskModel::STATUS_CLOSED), ); $tasks = $this->task->find($filters); diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 1b67b6a0..8230eef3 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -2,8 +2,7 @@ namespace Controller; -use Model\Project; -use Model\File; +use Model\Project as ProjectModel; /** * Task controller @@ -13,19 +12,6 @@ use Model\File; */ class Task extends Base { - private function getTask() - { - $task = $this->task->getById($this->request->getIntegerParam('task_id'), true); - - if (! $task) { - $this->notfound(); - } - - $this->checkProjectPermissions($task['project_id']); - - return $task; - } - /** * Webhook to create a task (useful for external software) * @@ -71,41 +57,17 @@ class Task extends Base */ public function show() { - $this->showTask($this->getTask()); - } - - /** - * Add a description from the show task page - * - * @access public - */ - public function description() - { - $task = $this->task->getById($this->request->getIntegerParam('task_id'), true); - $values = $this->request->getValues(); - - if (! $task) $this->notfound(); - $this->checkProjectPermissions($task['project_id']); - - list($valid, $errors) = $this->task->validateDescriptionCreation($values); - - if ($valid) { - - if ($this->task->update($values)) { - $this->session->flash(t('Task updated successfully.')); - } - else { - $this->session->flashError(t('Unable to update your task.')); - } - - $this->response->redirect('?controller=task&action=show&task_id='.$task['id']); - } + $task = $this->getTask(); - $this->showTask( - $task, - array(), - array('values' => $values, 'errors' => $errors) - ); + $this->response->html($this->taskLayout('task_show', array( + 'files' => $this->file->getAll($task['id']), + 'comments' => $this->comment->getAll($task['id']), + 'task' => $task, + 'columns_list' => $this->board->getColumnsList($task['project_id']), + 'colors_list' => $this->task->getColors(), + 'menu' => 'tasks', + 'title' => $task['title'], + ))); } /** @@ -127,7 +89,7 @@ class Task extends Base 'owner_id' => $this->request->getIntegerParam('owner_id'), 'another_task' => $this->request->getIntegerParam('another_task'), ), - 'projects_list' => $this->project->getListByStatus(\Model\Project::ACTIVE), + 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), 'columns_list' => $this->board->getColumnsList($project_id), 'users_list' => $this->project->getUsersList($project_id), 'colors_list' => $this->task->getColors(), @@ -171,7 +133,7 @@ class Task extends Base $this->response->html($this->template->layout('task_new', array( 'errors' => $errors, 'values' => $values, - 'projects_list' => $this->project->getListByStatus(Project::ACTIVE), + 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), 'columns_list' => $this->board->getColumnsList($values['project_id']), 'users_list' => $this->project->getUsersList($values['project_id']), 'colors_list' => $this->task->getColors(), @@ -188,10 +150,7 @@ class Task extends Base */ public function edit() { - $task = $this->task->getById($this->request->getIntegerParam('task_id')); - - if (! $task) $this->notfound(); - $this->checkProjectPermissions($task['project_id']); + $task = $this->getTask(); if (! empty($task['date_due'])) { $task['date_due'] = date(t('m/d/Y'), $task['date_due']); @@ -203,8 +162,9 @@ class Task extends Base $task['score'] = $task['score'] ?: ''; $this->response->html($this->template->layout('task_edit', array( - 'errors' => array(), 'values' => $task, + 'errors' => array(), + 'task' => $task, 'columns_list' => $this->board->getColumnsList($task['project_id']), 'users_list' => $this->project->getUsersList($task['project_id']), 'colors_list' => $this->task->getColors(), @@ -221,8 +181,8 @@ class Task extends Base */ public function update() { + $task = $this->getTask(); $values = $this->request->getValues(); - $this->checkProjectPermissions($values['project_id']); list($valid, $errors) = $this->task->validateModification($values); @@ -238,8 +198,9 @@ class Task extends Base } $this->response->html($this->template->layout('task_edit', array( - 'errors' => $errors, 'values' => $values, + 'errors' => $errors, + 'task' => $task, 'columns_list' => $this->board->getColumnsList($values['project_id']), 'users_list' => $this->project->getUsersList($values['project_id']), 'colors_list' => $this->task->getColors(), @@ -372,7 +333,7 @@ class Task extends Base $this->response->html($this->template->layout('task_new', array( 'errors' => array(), 'values' => $task, - 'projects_list' => $this->project->getListByStatus(Project::ACTIVE), + 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), 'columns_list' => $this->board->getColumnsList($task['project_id']), 'users_list' => $this->project->getUsersList($task['project_id']), 'colors_list' => $this->task->getColors(), @@ -384,124 +345,53 @@ class Task extends Base } /** - * File upload form + * Edit description form * * @access public */ - public function file() + public function editDescription() { $task = $this->getTask(); - $this->response->html($this->taskLayout('task_upload', array( + $this->response->html($this->taskLayout('task_edit_description', array( + 'values' => $task, + 'errors' => array(), 'task' => $task, 'menu' => 'tasks', - 'title' => t('Attach a document') + 'title' => t('Edit the description') ))); } /** - * File upload (save files) + * Save and validation the description * * @access public */ - public function upload() + public function saveDescription() { $task = $this->getTask(); - $this->file->upload($task['project_id'], $task['id'], 'files'); - $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#attachments'); - } - - /** - * File download - * - * @access public - */ - public function download() - { - $task = $this->getTask(); - $file = $this->file->getById($this->request->getIntegerParam('file_id')); - $filename = File::BASE_PATH.$file['path']; - - if ($file['task_id'] == $task['id'] && file_exists($filename)) { - $this->response->forceDownload($file['name']); - $this->response->binary(file_get_contents($filename)); - } - - $this->response->redirect('?controller=task&action=show&task_id='.$task['id']); - } - - /** - * Open a file (show the content in a popover) - * - * @access public - */ - public function openFile() - { - $task = $this->getTask(); - $file = $this->file->getById($this->request->getIntegerParam('file_id')); - - if ($file['task_id'] == $task['id']) { - $this->response->html($this->template->load('task_open_file', array( - 'file' => $file - ))); - } - } + $values = $this->request->getValues(); - /** - * Return the file content (work only for images) - * - * @access public - */ - public function image() - { - $task = $this->getTask(); - $file = $this->file->getById($this->request->getIntegerParam('file_id')); - $filename = File::BASE_PATH.$file['path']; + list($valid, $errors) = $this->task->validateDescriptionCreation($values); - if ($file['task_id'] == $task['id'] && file_exists($filename)) { - $metadata = getimagesize($filename); + if ($valid) { - if (isset($metadata['mime'])) { - $this->response->contentType($metadata['mime']); - readfile($filename); + if ($this->task->update($values)) { + $this->session->flash(t('Task updated successfully.')); + } + else { + $this->session->flashError(t('Unable to update your task.')); } - } - } - - /** - * Remove a file - * - * @access public - */ - public function removeFile() - { - $task = $this->getTask(); - $file = $this->file->getById($this->request->getIntegerParam('file_id')); - if ($file['task_id'] == $task['id'] && $this->file->remove($file['id'])) { - $this->session->flash(t('File removed successfully.')); - } else { - $this->session->flashError(t('Unable to remove this file.')); + $this->response->redirect('?controller=task&action=show&task_id='.$task['id']); } - $this->response->redirect('?controller=task&action=show&task_id='.$task['id']); - } - - /** - * Confirmation dialog before removing a file - * - * @access public - */ - public function confirmRemoveFile() - { - $task = $this->getTask(); - $file = $this->file->getById($this->request->getIntegerParam('file_id')); - - $this->response->html($this->taskLayout('task_remove_file', array( + $this->response->html($this->taskLayout('task_edit_description', array( + 'values' => $values, + 'errors' => $errors, 'task' => $task, - 'file' => $file, 'menu' => 'tasks', - 'title' => t('Remove a file') + 'title' => t('Edit the description') ))); } } diff --git a/app/Locales/es_ES/translations.php b/app/Locales/es_ES/translations.php index 7374f6b6..44e5934c 100644 --- a/app/Locales/es_ES/translations.php +++ b/app/Locales/es_ES/translations.php @@ -338,4 +338,9 @@ return array( // 'Do you really want to remove this file: "%s"?' => '', // 'open' => '', // 'Attachments' => '', + // 'Edit the task' => '', + // 'Edit the description' => '', + // 'Add a comment' => '', + // 'Edit a comment' => '', + // 'Summary' => '', ); diff --git a/app/Locales/fr_FR/translations.php b/app/Locales/fr_FR/translations.php index 26fee468..8cf37701 100644 --- a/app/Locales/fr_FR/translations.php +++ b/app/Locales/fr_FR/translations.php @@ -338,4 +338,9 @@ return array( 'Do you really want to remove this file: "%s"?' => 'Voulez-vous vraiment supprimer ce fichier « %s » ?', 'open' => 'ouvrir', 'Attachments' => 'Pièces-jointes', + 'Edit the task' => 'Modifier la tâche', + 'Edit the description' => 'Modifier la description', + 'Add a comment' => 'Ajouter un commentaire', + 'Edit a comment' => 'Modifier un commentaire', + 'Summary' => 'Résumé', ); diff --git a/app/Locales/pl_PL/translations.php b/app/Locales/pl_PL/translations.php index 43adb330..f8365d9c 100644 --- a/app/Locales/pl_PL/translations.php +++ b/app/Locales/pl_PL/translations.php @@ -343,4 +343,9 @@ return array( // 'Do you really want to remove this file: "%s"?' => '', // 'open' => '', // 'Attachments' => '', + // 'Edit the task' => '', + // 'Edit the description' => '', + // 'Add a comment' => '', + // 'Edit a comment' => '', + // 'Summary' => '', ); diff --git a/app/Locales/pt_BR/translations.php b/app/Locales/pt_BR/translations.php index 0b4765d1..6038670a 100644 --- a/app/Locales/pt_BR/translations.php +++ b/app/Locales/pt_BR/translations.php @@ -339,4 +339,9 @@ return array( // 'Do you really want to remove this file: "%s"?' => '', // 'open' => '', // 'Attachments' => '', + // 'Edit the task' => '', + // 'Edit the description' => '', + // 'Add a comment' => '', + // 'Edit a comment' => '', + // 'Summary' => '', ); diff --git a/app/Model/Acl.php b/app/Model/Acl.php index be32196a..c6ed8686 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -32,9 +32,10 @@ class Acl extends Base 'app' => array('index'), 'board' => array('index', 'show', 'assign', 'assigntask', 'save', 'check'), 'project' => array('tasks', 'index', 'forbidden', 'search'), - 'comment' => array('save', 'confirm', 'remove', 'update', 'edit'), 'user' => array('index', 'edit', 'update', 'forbidden', 'logout', 'index', 'unlinkgoogle'), 'config' => array('index', 'removeremembermetoken'), + 'comment' => array('create', 'save', 'confirm', 'remove', 'update', 'edit', 'forbidden'), + 'file' => array('create', 'save', 'download', 'confirm', 'remove', 'open', 'image'), 'task' => array( 'show', 'create', @@ -45,17 +46,11 @@ class Acl extends Base 'confirmclose', 'open', 'confirmopen', - 'description', 'duplicate', 'remove', 'confirmremove', - 'file', - 'upload', - 'download', - 'openfile', - 'image', - 'removefile', - 'confirmremovefile', + 'editdescription', + 'savedescription', ), ); diff --git a/app/Model/Base.php b/app/Model/Base.php index fef2ddbb..e95296bb 100644 --- a/app/Model/Base.php +++ b/app/Model/Base.php @@ -30,7 +30,7 @@ abstract class Base * Database instance * * @access protected - * @var PicoDb + * @var \PicoDb\Database */ protected $db; @@ -38,7 +38,7 @@ abstract class Base * Event dispatcher instance * * @access protected - * @var Core\Event + * @var \Core\Event */ protected $event; diff --git a/app/Templates/comment_create.php b/app/Templates/comment_create.php new file mode 100644 index 00000000..a566d9c8 --- /dev/null +++ b/app/Templates/comment_create.php @@ -0,0 +1,17 @@ +<div class="page-header"> + <h2><?= t('Add a comment') ?></h2> +</div> + +<form method="post" action="?controller=comment&action=save&task_id=<?= $task['id'] ?>" autocomplete="off"> + + <?= Helper\form_hidden('task_id', $values) ?> + <?= Helper\form_hidden('user_id', $values) ?> + <?= Helper\form_textarea('comment', $values, $errors, array('required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?><br/> + <div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div> + + <div class="form-actions"> + <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> + <?= t('or') ?> + <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a> + </div> +</form> diff --git a/app/Templates/comment_edit.php b/app/Templates/comment_edit.php new file mode 100644 index 00000000..0a17a95e --- /dev/null +++ b/app/Templates/comment_edit.php @@ -0,0 +1,15 @@ +<div class="page-header"> + <h2><?= t('Edit a comment') ?></h2> +</div> + +<form method="post" action="?controller=comment&action=update&task_id=<?= $task['id'] ?>&comment_id=<?= $comment['id'] ?>" autocomplete="off"> + + <?= Helper\form_hidden('id', $values) ?> + <?= Helper\form_textarea('comment', $values, $errors, array('required', 'placeholder="'.t('Leave a comment').'"')) ?><br/> + + <div class="form-actions"> + <input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/> + <?= t('or') ?> + <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a> + </div> +</form> diff --git a/app/Templates/comment_remove.php b/app/Templates/comment_remove.php index ad1b8e4a..02a23f93 100644 --- a/app/Templates/comment_remove.php +++ b/app/Templates/comment_remove.php @@ -1,18 +1,16 @@ -<section id="main"> - <div class="page-header"> - <h2><?= t('Remove a comment') ?></h2> - </div> +<div class="page-header"> + <h2><?= t('Add a comment') ?></h2> +</div> - <div class="confirm"> - <p class="alert alert-info"> - <?= t('Do you really want to remove this comment?') ?> - </p> +<div class="confirm"> + <p class="alert alert-info"> + <?= t('Do you really want to remove this comment?') ?> + </p> - <?= Helper\template('comment_show', array('comment' => $comment)) ?> + <?= Helper\template('comment_show', array('comment' => $comment, 'task' => $task, 'preview' => true)) ?> - <div class="form-actions"> - <a href="?controller=comment&action=remove&project_id=<?= $project_id ?>&comment_id=<?= $comment['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a> - <?= t('or') ?> <a href="?controller=task&action=show&task_id=<?= $comment['task_id'] ?>#comment-<?= $comment['id'] ?>"><?= t('cancel') ?></a> - </div> + <div class="form-actions"> + <a href="?controller=comment&action=remove&task_id=<?= $task['id'] ?>&comment_id=<?= $comment['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a> + <?= t('or') ?> <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>#comment-<?= $comment['id'] ?>"><?= t('cancel') ?></a> </div> -</section>
\ No newline at end of file +</div>
\ No newline at end of file diff --git a/app/Templates/comment_show.php b/app/Templates/comment_show.php index 24bf9070..227c0fcc 100644 --- a/app/Templates/comment_show.php +++ b/app/Templates/comment_show.php @@ -1,36 +1,28 @@ -<div class="<?= isset($display_edit_form) && $display_edit_form === true ? 'comment-edit' : 'comment' ?>" id="comment-<?= $comment['id'] ?>"> +<div class="comment <?= isset($preview) ? 'comment-preview' : '' ?>" id="comment-<?= $comment['id'] ?>"> + <p class="comment-title"> <span class="comment-username"><?= Helper\escape($comment['username']) ?></span> @ <span class="comment-date"><?= dt('%B %e, %G at %k:%M %p', $comment['date']) ?></span> </p> - <?php if (isset($task)): ?> - <ul class="comment-actions"> - <li><a href="#comment-<?= $comment['id'] ?>"><?= t('link') ?></a></li> - <?php if (Helper\is_admin() || Helper\is_current_user($comment['user_id'])): ?> - <li> - <a href="?controller=comment&action=confirm&project_id=<?= $task['project_id'] ?>&comment_id=<?= $comment['id'] ?>"><?= t('remove') ?></a> - </li> - <li> - <a href="?controller=comment&action=edit&task_id=<?= $task['id'] ?>&comment_id=<?= $comment['id'] ?>#comment-<?= $comment['id'] ?>"><?= t('edit') ?></a> - </li> - <?php endif ?> - </ul> - <?php endif ?> - <?php if (isset($display_edit_form) && $display_edit_form === true): ?> - <form method="post" action="?controller=comment&action=update&task_id=<?= $task['id'] ?>&comment_id=<?= $comment['id'] ?>" autocomplete="off"> + <div class="comment-inner"> + + <?php if (! isset($preview)): ?> + <ul class="comment-actions"> + <li><a href="#comment-<?= $comment['id'] ?>"><?= t('link') ?></a></li> + <?php if (Helper\is_admin() || Helper\is_current_user($comment['user_id'])): ?> + <li> + <a href="?controller=comment&action=confirm&task_id=<?= $task['id'] ?>&comment_id=<?= $comment['id'] ?>"><?= t('remove') ?></a> + </li> + <li> + <a href="?controller=comment&action=edit&task_id=<?= $task['id'] ?>&comment_id=<?= $comment['id'] ?>"><?= t('edit') ?></a> + </li> + <?php endif ?> + </ul> + <?php endif ?> - <?= Helper\form_hidden('id', $values) ?> - <?= Helper\form_textarea('comment', $values, $errors, array('required', 'placeholder="'.t('Leave a comment').'"')) ?><br/> + <div class="markdown"> + <?= Helper\parse($comment['comment']) ?> + </div> - <div class="form-actions"> - <input type="submit" value="<?= t('Update this comment') ?>" class="btn btn-blue"/> - <?= t('or') ?> - <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a> - </div> - </form> - <?php else: ?> - <div class="markdown"> - <?= Helper\markdown($comment['comment']) ?> </div> - <?php endif ?> </div>
\ No newline at end of file diff --git a/app/Templates/task_upload.php b/app/Templates/file_new.php index 7100ab31..43223d0c 100644 --- a/app/Templates/task_upload.php +++ b/app/Templates/file_new.php @@ -2,9 +2,11 @@ <h2><?= t('Attach a document') ?></h2> </div> -<form action="?controller=task&action=upload&task_id=<?= $task['id'] ?>" method="post" enctype="multipart/form-data"> +<form action="?controller=file&action=save&task_id=<?= $task['id'] ?>" method="post" enctype="multipart/form-data"> <input type="file" name="files[]" multiple /> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> + <?= t('or') ?> + <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a> </div> </form>
\ No newline at end of file diff --git a/app/Templates/task_open_file.php b/app/Templates/file_open.php index e0817f01..aa181d64 100644 --- a/app/Templates/task_open_file.php +++ b/app/Templates/file_open.php @@ -1,6 +1,6 @@ <div class="page-header"> <h2><?= Helper\escape($file['name']) ?></h2> <div class="task-file-viewer"> - <img src="?controller=task&action=image&file_id=<?= $file['id'] ?>&task_id=<?= $file['task_id'] ?>" alt="<?= Helper\escape($file['name']) ?>"/> + <img src="?controller=file&action=image&file_id=<?= $file['id'] ?>&task_id=<?= $file['task_id'] ?>" alt="<?= Helper\escape($file['name']) ?>"/> </div> </div>
\ No newline at end of file diff --git a/app/Templates/task_remove_file.php b/app/Templates/file_remove.php index 9687b602..1d26c15e 100644 --- a/app/Templates/task_remove_file.php +++ b/app/Templates/file_remove.php @@ -8,7 +8,7 @@ </p> <div class="form-actions"> - <a href="?controller=task&action=removeFile&task_id=<?= $task['id'] ?>&file_id=<?= $file['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a> + <a href="?controller=file&action=remove&task_id=<?= $task['id'] ?>&file_id=<?= $file['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a> <?= t('or') ?> <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a> </div> </div>
\ No newline at end of file diff --git a/app/Templates/task_edit.php b/app/Templates/task_edit.php index 8c8bc107..d698c21d 100644 --- a/app/Templates/task_edit.php +++ b/app/Templates/task_edit.php @@ -1,9 +1,12 @@ <section id="main"> <div class="page-header"> <h2><?= t('Edit a task') ?></h2> + <ul> + <li><a href="?controller=board&action=show&project_id=<?= $task['project_id'] ?>"><?= t('Back to the board') ?></a></li> + </ul> </div> <section> - <form method="post" action="?controller=task&action=update" autocomplete="off"> + <form method="post" action="?controller=task&action=update&task_id=<?= $task['id'] ?>" autocomplete="off"> <div class="form-column"> @@ -44,7 +47,7 @@ <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> - <?= t('or') ?> <a href="?controller=board&action=show&project_id=<?= $values['project_id'] ?>"><?= t('cancel') ?></a> + <?= t('or') ?> <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a> </div> </form> </section> diff --git a/app/Templates/task_edit_description.php b/app/Templates/task_edit_description.php new file mode 100644 index 00000000..0bdc40a2 --- /dev/null +++ b/app/Templates/task_edit_description.php @@ -0,0 +1,16 @@ +<div class="page-header"> + <h2><?= t('Edit the description') ?></h2> +</div> + +<form method="post" action="?controller=task&action=saveDescription&task_id=<?= $task['id'] ?>" autocomplete="off"> + + <?= Helper\form_hidden('id', $values) ?> + <?= Helper\form_textarea('description', $values, $errors, array('required', 'placeholder="'.t('Leave a description').'"'), 'description-textarea') ?><br/> + <div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div> + + <div class="form-actions"> + <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> + <?= t('or') ?> + <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a> + </div> +</form> diff --git a/app/Templates/task_show.php b/app/Templates/task_show.php index 56f6cba5..53cdbae8 100644 --- a/app/Templates/task_show.php +++ b/app/Templates/task_show.php @@ -1,111 +1,99 @@ -<article class="task task-<?= $task['color_id'] ?> task-show-details"> +<div class="task-<?= $task['color_id'] ?> task-show-details"> <h2><?= Helper\escape($task['title']) ?></h2> -<?php if ($task['score']): ?> - <span class="task-score"><?= Helper\escape($task['score']) ?></span> -<?php endif ?> -<ul> - <li> - <?= dt('Created on %B %e, %G at %k:%M %p', $task['date_creation']) ?> - </li> - <?php if ($task['date_completed']): ?> - <li> - <?= dt('Completed on %B %e, %G at %k:%M %p', $task['date_completed']) ?> - </li> - <?php endif ?> - <?php if ($task['date_due']): ?> - <li> - <strong><?= dt('Must be done before %B %e, %G', $task['date_due']) ?></strong> - </li> + <?php if ($task['score']): ?> + <span class="task-score"><?= Helper\escape($task['score']) ?></span> <?php endif ?> - <li> - <strong> - <?php if ($task['username']): ?> - <?= t('Assigned to %s', $task['username']) ?> - <?php else: ?> - <?= t('There is nobody assigned') ?> + <ul> + <li> + <?= dt('Created on %B %e, %G at %k:%M %p', $task['date_creation']) ?> + </li> + <?php if ($task['date_completed']): ?> + <li> + <?= dt('Completed on %B %e, %G at %k:%M %p', $task['date_completed']) ?> + </li> <?php endif ?> - </strong> - </li> - <li> - <?= t('Column on the board:') ?> - <strong><?= Helper\escape($task['column_title']) ?></strong> - (<?= Helper\escape($task['project_name']) ?>) - </li> - <?php if ($task['category_name']): ?> - <li> - <?= t('Category:') ?> <strong><?= Helper\escape($task['category_name']) ?></strong> - </li> - <?php endif ?> - <li> - <?php if ($task['is_active'] == 1): ?> - <?= t('Status is open') ?> - <?php else: ?> - <?= t('Status is closed') ?> + <?php if ($task['date_due']): ?> + <li> + <strong><?= dt('Must be done before %B %e, %G', $task['date_due']) ?></strong> + </li> <?php endif ?> - </li> -</ul> -</article> + <li> + <strong> + <?php if ($task['username']): ?> + <?= t('Assigned to %s', $task['username']) ?> + <?php else: ?> + <?= t('There is nobody assigned') ?> + <?php endif ?> + </strong> + </li> + <li> + <?= t('Column on the board:') ?> + <strong><?= Helper\escape($task['column_title']) ?></strong> + (<?= Helper\escape($task['project_name']) ?>) + </li> + <?php if ($task['category_name']): ?> + <li> + <?= t('Category:') ?> <strong><?= Helper\escape($task['category_name']) ?></strong> + </li> + <?php endif ?> + <li> + <?php if ($task['is_active'] == 1): ?> + <?= t('Status is open') ?> + <?php else: ?> + <?= t('Status is closed') ?> + <?php endif ?> + </li> + </ul> +</div> + + +<?php if (! empty($task['description'])): ?> +<div id="description" class="task-show-section"> + <div class="page-header"> + <h2><?= t('Description') ?></h2> + </div> -<h2><?= t('Description') ?></h2> -<?php if ($task['description']): ?> <article class="markdown task-show-description"> <?= Helper\parse($task['description']) ?: t('There is no description.') ?> </article> -<?php else: ?> - <form method="post" action="?controller=task&action=description&task_id=<?= $task['id'] ?>" autocomplete="off"> - - <?= Helper\form_hidden('id', $description_form['values']) ?> - <?= Helper\form_textarea('description', $description_form['values'], $description_form['errors'], array('required', 'placeholder="'.t('Leave a description').'"')) ?><br/> - <div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div> - - <div class="form-actions"> - <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> - </div> - </form> +</div> <?php endif ?> + <?php if (! empty($files)): ?> - <h2 id="attachments"><?= t('Attachments') ?></h2> +<div id="attachments" class="task-show-section"> + <div class="page-header"> + <h2><?= t('Attachments') ?></h2> + </div> + <ul class="task-show-files"> <?php foreach ($files as $file): ?> <li> - <a href="?controller=task&action=download&file_id=<?= $file['id'] ?>&task_id=<?= $task['id'] ?>"><?= Helper\escape($file['name']) ?></a> + <a href="?controller=file&action=download&file_id=<?= $file['id'] ?>&task_id=<?= $task['id'] ?>"><?= Helper\escape($file['name']) ?></a> <span class="task-show-file-actions"> <?php if ($file['is_image']): ?> - <a href="?controller=task&action=openFile&file_id=<?= $file['id'] ?>&task_id=<?= $task['id'] ?>" class="popover"><?= t('open') ?></a>, + <a href="?controller=file&action=open&file_id=<?= $file['id'] ?>&task_id=<?= $task['id'] ?>" class="popover"><?= t('open') ?></a>, <?php endif ?> - <a href="?controller=task&action=confirmRemoveFile&file_id=<?= $file['id'] ?>&task_id=<?= $task['id'] ?>"><?= t('remove') ?></a> + <a href="?controller=file&action=confirm&file_id=<?= $file['id'] ?>&task_id=<?= $task['id'] ?>"><?= t('remove') ?></a> </span> </li> <?php endforeach ?> </ul> +</div> <?php endif ?> -<h2><?= t('Comments') ?></h2> -<?php if ($comments): ?> - <ul id="comments"> + +<?php if (! empty($comments)): ?> +<div id="comments" class="task-show-section"> + <div class="page-header"> + <h2><?= t('Comments') ?></h2> + </div> + <?php foreach ($comments as $comment): ?> <?= Helper\template('comment_show', array( 'comment' => $comment, 'task' => $task, - 'display_edit_form' => $comment['id'] == $comment_edit_form['values']['id'], - 'values' => $comment_edit_form['values'] + array('comment' => $comment['comment']), - 'errors' => $comment_edit_form['errors'] )) ?> <?php endforeach ?> - </ul> +</div> <?php endif ?> - -<?php if (! isset($hide_comment_form) || $hide_comment_form === false): ?> -<form method="post" action="?controller=comment&action=save&task_id=<?= $task['id'] ?>" autocomplete="off"> - - <?= Helper\form_hidden('task_id', $comment_form['values']) ?> - <?= Helper\form_hidden('user_id', $comment_form['values']) ?> - <?= Helper\form_textarea('comment', $comment_form['values'], $comment_form['errors'], array('required', 'placeholder="'.t('Leave a comment').'"'), 'comment-textarea') ?><br/> - <div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div> - - <div class="form-actions"> - <input type="submit" value="<?= t('Post comment') ?>" class="btn btn-blue"/> - </div> -</form> -<?php endif ?>
\ No newline at end of file diff --git a/app/Templates/task_sidebar.php b/app/Templates/task_sidebar.php index 9dbc1a8c..8a3939b8 100644 --- a/app/Templates/task_sidebar.php +++ b/app/Templates/task_sidebar.php @@ -2,9 +2,11 @@ <h2><?= t('Actions') ?></h2> <div class="task-show-actions"> <ul> - <li><a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('Description') ?></a></li> - <li><a href="?controller=task&action=edit&task_id=<?= $task['id'] ?>"><?= t('Edit') ?></a></li> - <li><a href="?controller=task&action=file&task_id=<?= $task['id'] ?>"><?= t('Attach a document') ?></a></li> + <li><a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('Summary') ?></a></li> + <li><a href="?controller=task&action=edit&task_id=<?= $task['id'] ?>"><?= t('Edit the task') ?></a></li> + <li><a href="?controller=task&action=editDescription&task_id=<?= $task['id'] ?>"><?= t('Edit the description') ?></a></li> + <li><a href="?controller=comment&action=create&task_id=<?= $task['id'] ?>"><?= t('Add a comment') ?></a></li> + <li><a href="?controller=file&action=create&task_id=<?= $task['id'] ?>"><?= t('Attach a document') ?></a></li> <li><a href="?controller=task&action=duplicate&project_id=<?= $task['project_id'] ?>&task_id=<?= $task['id'] ?>"><?= t('Duplicate') ?></a></li> <li> <?php if ($task['is_active'] == 1): ?> diff --git a/assets/css/app.css b/assets/css/app.css index 51bdb878..78fc29bd 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -673,6 +673,7 @@ div.task .task-score { .task-show-details { position: relative; border-radius: 5px; + padding-bottom: 10px; } .task-show-details h2 { @@ -695,11 +696,9 @@ div.task .task-score { bottom: 5px; } -.task-show-description { - border: 1px solid #999; - border-radius: 5px; - background: #f0f0f0; - padding: 10px; +.task-show-section { + margin-top: 30px; + margin-bottom: 20px; } .task-show-files a { @@ -729,6 +728,12 @@ div.task .task-score { color: #333; } +.description-textarea { + width: 80%; + max-width: 800px; + height: 300px; +} + .task-file-viewer { position: relative; } @@ -739,98 +744,39 @@ div.task .task-score { margin-top: 10px; } -/* markdown content */ -.markdown { - line-height: 1.4em; -} - -.markdown h1 { - margin-top: 5px; - margin-bottom: 10px; - font-size: 2em; - padding-bottom: 3px; - border-bottom: 1px dotted #000; -} - -.markdown h2 { - text-decoration: underline; -} - -.markdown h3 { - font-weight: bold; - text-decoration: underline; -} - -.markdown ol, -.markdown ul { - margin-left: 25px; - margin-top: 10px; - margin-bottom: 10px; -} - -.markdown pre { - background: #fff; - padding: 10px; - border-radius: 5px; - border: 1px dashed #000; - overflow: auto; - color: #000; -} - -.markdown blockquote { - font-style: italic; - border-left: 5px solid #ddd; - padding-left: 8px; -} - /* comments */ .comment { - margin-bottom: 25px; - padding: 0; - border: 1px solid #ddd; - border-radius: 5px; -} - -.comment-edit { - margin-bottom: 25px; - padding: 0; - border: 2px solid #000; - border-radius: 5px; + margin-bottom: 20px; } .comment:hover { - border: 1px solid #888; + background: #F7F8E0; } -.comment-title { - font-size: 0.9em; - padding: 5px; - margin-bottom: 2px; - border-bottom: 1px solid #ddd; - border-top-left-radius: 5px; - border-top-right-radius: 5px; - background: #f0f0f0; -} - -.comment:nth-child(odd) .comment-title { - background: #f0f0f0; +.comment-inner { + border-left: 4px solid #333; + padding-bottom: 10px; + padding-left: 20px; + margin-left: 20px; + margin-right: 10px; } -.comment:nth-child(even) .comment-title { - background: #ddd; +.comment-preview { + border: 2px solid #000; + border-radius: 3px; + padding: 10px; } -.comment-actions a, -.comment-title a { - color: #000; - text-decoration: none; +.comment-preview .comment-inner { + border: none; + padding: 0; + margin: 0; } -.comment-actions a:hover, -.comment-actions a:focus, -.comment-title a:hover, -.comment-title a:focus { - text-decoration: underline; +.comment-title { + margin-bottom: 8px; + padding-bottom: 3px; + border-bottom: 1px dotted #aaa; } .comment-actions { @@ -847,6 +793,7 @@ div.task .task-score { } .comment-actions li:last-child { + padding-right: 0; border: 0; } @@ -855,20 +802,57 @@ div.task .task-score { } .comment-textarea { - height: 70px; - width: 500px; + height: 200px; + width: 80%; + max-width: 800px; } -.comment .markdown { - margin: 10px; +/* markdown content */ +.markdown { + line-height: 1.4em; } -.comment .markdown pre { - background: #fdfdfd; +.markdown h1 { + margin-top: 5px; + margin-bottom: 10px; + font-size: 2em; + padding-bottom: 3px; + border-bottom: 1px dotted #000; } -.comment-edit form { - border: none; +.markdown h2 { + text-decoration: underline; +} + +.markdown h3 { + font-weight: bold; + text-decoration: underline; +} + +.markdown ol, +.markdown ul { + margin-left: 25px; + margin-top: 10px; + margin-bottom: 10px; +} + +.markdown pre { + background: #fafafa; + padding: 10px; + border-radius: 5px; + border: 1px solid #ccc; + overflow: auto; + color: brown; +} + +.markdown blockquote { + font-style: italic; + border-left: 5px solid #ddd; + padding-left: 8px; +} + +.markdown p { + margin-bottom: 10px; } /* task colors */ |