summaryrefslogtreecommitdiff
path: root/app/Template/file_viewer/show.php
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/file_viewer/show.php
parent4961805e0f8a8c3630ace144450fdd97048b3929 (diff)
Add file preview for Markdown and text files
Diffstat (limited to 'app/Template/file_viewer/show.php')
-rw-r--r--app/Template/file_viewer/show.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/Template/file_viewer/show.php b/app/Template/file_viewer/show.php
index e0d1b21e..c71ef91c 100644
--- a/app/Template/file_viewer/show.php
+++ b/app/Template/file_viewer/show.php
@@ -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> \ No newline at end of file