summaryrefslogtreecommitdiff
path: root/app/Template/task_file
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-02-16 22:06:53 -0500
committerFrederic Guillot <fred@kanboard.net>2016-02-16 22:06:53 -0500
commit924949850322144036e281bf94fb8b88c42bbd74 (patch)
tree5e57db68f507849bb8c7a92574fbe6a3f319c009 /app/Template/task_file
parent4961805e0f8a8c3630ace144450fdd97048b3929 (diff)
Add file preview for Markdown and text files
Diffstat (limited to 'app/Template/task_file')
-rw-r--r--app/Template/task_file/show.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/app/Template/task_file/show.php b/app/Template/task_file/show.php
index 67d7a99c..8aa76520 100644
--- a/app/Template/task_file/show.php
+++ b/app/Template/task_file/show.php
@@ -14,16 +14,16 @@
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->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 ?>
- <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>
</ul>
</div>
</div>
@@ -54,16 +54,22 @@
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->e($file['name']) ?> <i class="fa fa-caret-down"></i></a>
<ul>
- <?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?>
+ <?php if ($this->file->getPreviewType($file['name']) !== null): ?>
<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') ?>
+ <i class="fa fa-eye fa-fw"></i>
+ <?= $this->url->link(t('View'), '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>