Add file preview for Markdown and text files
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
<div class="page-header">
|
||||
<h2><?= $this->e($file['name']) ?></h2>
|
||||
<div class="task-file-viewer">
|
||||
<?php if ($file['is_image']): ?>
|
||||
<img src="<?= $this->url->href('FileViewer', 'image', $params) ?>" alt="<?= $this->e($file['name']) ?>">
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="file-viewer">
|
||||
<?php if ($file['is_image']): ?>
|
||||
<img src="<?= $this->url->href('FileViewer', 'image', $params) ?>" alt="<?= $this->e($file['name']) ?>">
|
||||
<?php elseif ($type === 'markdown'): ?>
|
||||
<article class="markdown">
|
||||
<?= $this->text->markdown($content) ?>
|
||||
</article>
|
||||
<?php elseif ($type === 'text'): ?>
|
||||
<pre><?= $content ?></pre>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
@@ -24,16 +24,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('project_id' => $project['id'], 'file_id' => $file['id'])) ?>
|
||||
</li>
|
||||
<?php if ($this->user->hasProjectAccess('ProjectFile', 'remove', $project['id'])): ?>
|
||||
<li>
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
<?= $this->url->link(t('Remove'), 'ProjectFile', 'confirm', array('project_id' => $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('project_id' => $project['id'], 'file_id' => $file['id'])) ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,16 +64,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('ProjectFile', 'remove', $project['id'])): ?>
|
||||
<?php if ($this->file->getPreviewType($file['name']) !== null): ?>
|
||||
<li>
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
<?= $this->url->link(t('Remove'), 'ProjectFile', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?>
|
||||
<i class="fa fa-eye fa-fw"></i>
|
||||
<?= $this->url->link(t('View'), 'FileViewer', 'show', array('project_id' => $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('project_id' => $project['id'], 'file_id' => $file['id'])) ?>
|
||||
</li>
|
||||
<?php if ($this->user->hasProjectAccess('ProjectFile', 'remove', $project['id'])): ?>
|
||||
<li>
|
||||
<i class="fa fa-trash fa-fw"></i>
|
||||
<?= $this->url->link(t('Remove'), 'ProjectFile', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id']), false, 'popover') ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user