From 88ba0c0953395e18dbdd871e96831d885f59740c Mon Sep 17 00:00:00 2001 From: BlueTeck Date: Mon, 2 Mar 2015 22:40:09 +0100 Subject: preview images in taskview --- app/Controller/Task.php | 3 +- app/Model/File.php | 32 +++++++++++++++++++++ app/Template/file/show.php | 70 +++++++++++++++++++++++++++++++++------------- app/Template/task/show.php | 2 +- assets/css/app.css | 32 +++++++++++++++++++++ assets/css/src/task.css | 32 +++++++++++++++++++++ 6 files changed, 149 insertions(+), 22 deletions(-) diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 741db61e..d94c5908 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -68,7 +68,8 @@ class Task extends Base $this->response->html($this->taskLayout('task/show', array( 'project' => $this->project->getById($task['project_id']), - 'files' => $this->file->getAll($task['id']), + 'files' => $this->file->getAllDocuments($task['id']), + 'images' => $this->file->getAllImages($task['id']), 'comments' => $this->comment->getAll($task['id']), 'subtasks' => $subtasks, 'links' => $this->taskLink->getLinks($task['id']), diff --git a/app/Model/File.php b/app/Model/File.php index f069c8cf..46710658 100644 --- a/app/Model/File.php +++ b/app/Model/File.php @@ -111,6 +111,38 @@ class File extends Base ->asc('name') ->findAll(); } + + /** + * Get all images for a given task + * + * @access public + * @param integer $task_id Task id + * @return array + */ + public function getAllImages($task_id) + { + return $this->db->table(self::TABLE) + ->eq('task_id', $task_id) + ->eq('is_image', 1) + ->asc('name') + ->findAll(); + } + + /** + * Get all files without images for a given task + * + * @access public + * @param integer $task_id Task id + * @return array + */ + public function getAllDocuments($task_id) + { + return $this->db->table(self::TABLE) + ->eq('task_id', $task_id) + ->eq('is_image', 0) + ->asc('name') + ->findAll(); + } /** * Check if a filename is an image diff --git a/app/Template/file/show.php b/app/Template/file/show.php index 298976f6..2af5a7aa 100644 --- a/app/Template/file/show.php +++ b/app/Template/file/show.php @@ -1,23 +1,53 @@ - -
+ +
- + + +

+ +

+
    + +
  • +
    + <?= $this->e($file['name']) ?> +
    +

    + e($file['name']) ?> +

    + + a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + a(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + +
  • + +
+ + +

+ +

+
    + +
  • + a($this->e($file['name']), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + + a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> + +
  • + +
-
    - -
  • - a($this->e($file['name']), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> - - - a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>, - - a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?> - -
  • - -
+
+ + - \ No newline at end of file + + + + endif ?> \ No newline at end of file diff --git a/app/Template/task/show.php b/app/Template/task/show.php index 1ff2ef43..45485e53 100644 --- a/app/Template/task/show.php +++ b/app/Template/task/show.php @@ -4,5 +4,5 @@ render('tasklink/show', array('task' => $task, 'links' => $links)) ?> render('subtask/show', array('task' => $task, 'subtasks' => $subtasks)) ?> render('task/timesheet', array('task' => $task)) ?> -render('file/show', array('task' => $task, 'files' => $files)) ?> +render('file/show', array('task' => $task, 'files' => $files, 'images' => $images)) ?> render('task/comments', array('task' => $task, 'comments' => $comments, 'project' => $project)) ?> diff --git a/assets/css/app.css b/assets/css/app.css index f0446f30..a304d27f 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -1551,3 +1551,35 @@ td li.dropit-trigger { .task-board .dropit-submenu a:hover { text-decoration: none; } +.task-show-images { + list-style-type: none; +} +.task-show-images li img { + width: 100%; +} +.task-show-images li .img_container { + width: 250px; + height: 100px; + overflow: hidden; +} +.task-show-images li { + padding: 10px; + overflow: auto; + width: 250px; + min-height: 120px; + display: inline-block; + vertical-align: top; +} +.task-show-images li p{ + padding: 5px; + font-weight: bold; +} +.task-show-images li:hover { + background: #eee; +} +.task-show-image-actions { + margin-left: 5px; +} +.task-show-images li .img_container:hover { + height: 100%; +} \ No newline at end of file diff --git a/assets/css/src/task.css b/assets/css/src/task.css index b7a5cb9c..5cb7b969 100644 --- a/assets/css/src/task.css +++ b/assets/css/src/task.css @@ -245,3 +245,35 @@ span.task-board-date-overdue { .task-link-closed { text-decoration: line-through; } +.task-show-images { + list-style-type: none; +} +.task-show-images li img { + width: 100%; +} +.task-show-images li .img_container { + width: 250px; + height: 100px; + overflow: hidden; +} +.task-show-images li { + padding: 10px; + overflow: auto; + width: 250px; + min-height: 120px; + display: inline-block; + vertical-align: top; +} +.task-show-images li p{ + padding: 5px; + font-weight: bold; +} +.task-show-images li:hover { + background: #eee; +} +.task-show-image-actions { + margin-left: 5px; +} +.task-show-images li .img_container:hover { + height: 100%; +} -- cgit v1.2.3