preview images in taskview
This commit is contained in:
@@ -68,7 +68,8 @@ class Task extends Base
|
|||||||
|
|
||||||
$this->response->html($this->taskLayout('task/show', array(
|
$this->response->html($this->taskLayout('task/show', array(
|
||||||
'project' => $this->project->getById($task['project_id']),
|
'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']),
|
'comments' => $this->comment->getAll($task['id']),
|
||||||
'subtasks' => $subtasks,
|
'subtasks' => $subtasks,
|
||||||
'links' => $this->taskLink->getLinks($task['id']),
|
'links' => $this->taskLink->getLinks($task['id']),
|
||||||
|
|||||||
@@ -111,6 +111,38 @@ class File extends Base
|
|||||||
->asc('name')
|
->asc('name')
|
||||||
->findAll();
|
->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
|
* Check if a filename is an image
|
||||||
|
|||||||
@@ -1,23 +1,53 @@
|
|||||||
<?php if (! empty($files)): ?>
|
<?php if (!empty($files) || !empty($images)): ?>
|
||||||
<div id="attachments" class="task-show-section">
|
<div id="attachments" class="task-show-section">
|
||||||
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2><?= t('Attachments') ?></h2>
|
<h2><?= t('Attachments') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if (!empty($images)): ?>
|
||||||
|
<h3>
|
||||||
|
<?= t('Images') ?>
|
||||||
|
</h3>
|
||||||
|
<ul class="task-show-images">
|
||||||
|
<?php foreach ($images as $file): ?>
|
||||||
|
<li>
|
||||||
|
<div class="img_container">
|
||||||
|
<img src="<?= $this->u('file', 'image', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" alt="<?= $this->e($file['name']) ?>"/>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<?= $this->e($file['name']) ?>
|
||||||
|
</p>
|
||||||
|
<span class="task-show-file-actions task-show-image-actions">
|
||||||
|
<i class="fa fa-eye"></i> <?= $this->a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
|
||||||
|
<i class="fa fa-trash"></i> <?= $this->a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
|
||||||
|
<i class="fa fa-download"></i> <?= $this->a(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif
|
||||||
|
?>
|
||||||
|
<?php if (!empty($files)): ?>
|
||||||
|
<h3>
|
||||||
|
<?= t('Files') ?>
|
||||||
|
</h3>
|
||||||
|
<ul class="task-show-files">
|
||||||
|
<?php foreach ($files as $file): ?>
|
||||||
|
<li>
|
||||||
|
<?= $this->a($this->e($file['name']), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
|
||||||
|
<span class="task-show-file-actions">
|
||||||
|
<i class="fa fa-trash"></i> <?= $this->a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<ul class="task-show-files">
|
</div>
|
||||||
<?php foreach ($files as $file): ?>
|
<?php endif
|
||||||
<li>
|
?>
|
||||||
<?= $this->a($this->e($file['name']), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
|
<?php
|
||||||
<span class="task-show-file-actions">
|
|
||||||
<?php if ($file['is_image']): ?>
|
|
||||||
<?= $this->a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>,
|
|
||||||
<?php endif ?>
|
|
||||||
<?= $this->a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif ?>
|
|
||||||
|
|
||||||
|
endif ?>
|
||||||
@@ -4,5 +4,5 @@
|
|||||||
<?= $this->render('tasklink/show', array('task' => $task, 'links' => $links)) ?>
|
<?= $this->render('tasklink/show', array('task' => $task, 'links' => $links)) ?>
|
||||||
<?= $this->render('subtask/show', array('task' => $task, 'subtasks' => $subtasks)) ?>
|
<?= $this->render('subtask/show', array('task' => $task, 'subtasks' => $subtasks)) ?>
|
||||||
<?= $this->render('task/timesheet', array('task' => $task)) ?>
|
<?= $this->render('task/timesheet', array('task' => $task)) ?>
|
||||||
<?= $this->render('file/show', array('task' => $task, 'files' => $files)) ?>
|
<?= $this->render('file/show', array('task' => $task, 'files' => $files, 'images' => $images)) ?>
|
||||||
<?= $this->render('task/comments', array('task' => $task, 'comments' => $comments, 'project' => $project)) ?>
|
<?= $this->render('task/comments', array('task' => $task, 'comments' => $comments, 'project' => $project)) ?>
|
||||||
|
|||||||
@@ -1551,3 +1551,35 @@ td li.dropit-trigger {
|
|||||||
.task-board .dropit-submenu a:hover {
|
.task-board .dropit-submenu a:hover {
|
||||||
text-decoration: none;
|
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%;
|
||||||
|
}
|
||||||
@@ -245,3 +245,35 @@ span.task-board-date-overdue {
|
|||||||
.task-link-closed {
|
.task-link-closed {
|
||||||
text-decoration: line-through;
|
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%;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user