Add file preview for Markdown and text files

This commit is contained in:
Frederic Guillot
2016-02-16 22:06:53 -05:00
parent 4961805e0f
commit 9249498503
11 changed files with 109 additions and 38 deletions

View File

@@ -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>