From 5e5af86638d301658d3910b94c68e8a35f676c00 Mon Sep 17 00:00:00 2001
From: BlueTeck <tili2@gmx.de>
Date: Sat, 7 Mar 2015 11:31:53 +0100
Subject: add image thumbnail to task detail view, add icons to common file
 extensions, better layout in task attachments

---
 app/Template/board/files.php | 43 +++++++++++++++++++++++++++++++------------
 app/Template/file/show.php   | 27 +++++++++++++++------------
 2 files changed, 46 insertions(+), 24 deletions(-)

(limited to 'app/Template')

diff --git a/app/Template/board/files.php b/app/Template/board/files.php
index 278b906b..61529434 100644
--- a/app/Template/board/files.php
+++ b/app/Template/board/files.php
@@ -1,14 +1,33 @@
 <section>
-    <?php foreach ($files as $file): ?>
-		<i class="fa fa-file-o fa-fw"></i>
-
-        <?= $this->a(
-            $this->e($file['name']),
-            'file',
-            'download',
-            array('file_id' => $file['id'], 'task_id' => $file['task_id'], 'project_id' => $task['project_id'])
-        ) ?>
-
-        <br/>
-    <?php endforeach ?>
+    <table>
+        <?php if (!empty($images)): ?>
+            <?php foreach ($images as $file): ?>
+                <tr>
+                    <td><i class="fa fa-file-image-o fa-fw"></i>
+                        <?=
+                        $this->e($file['name'])
+                        ?>
+                    </td>
+                    <td>
+                        <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'])) ?>
+                        <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') ?>                                        
+                    </td>
+                </tr>
+            <?php endforeach ?>
+        <?php endif ?>
+        <?php if (!empty($files)): ?>
+            <?php foreach ($files as $file): ?>
+                <tr>
+                    <td><i class="fa <?= $this->file->get_icon($file['name']) ?> fa-fw"></i>
+                        <?=
+                        $this->e($file['name'])
+                        ?>
+                    </td>
+                    <td>
+                        <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'])) ?>
+                    </td>
+                </tr>
+            <?php endforeach ?>
+        <?php endif ?>
+    </table>
 </section>
diff --git a/app/Template/file/show.php b/app/Template/file/show.php
index 2af5a7aa..0f5bd4ee 100644
--- a/app/Template/file/show.php
+++ b/app/Template/file/show.php
@@ -12,7 +12,7 @@
                 <?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']) ?>"/>
+                            <img src="<?= $this->u('file', 'imageThumbnail', array('width' => 250, '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']) ?>
@@ -31,17 +31,20 @@
             <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>
-
+                <table class="task-show-file-table">
+                    <?php foreach ($files as $file): ?>
+                        <tr>
+                            <td><i class="fa <?= $this->file->get_icon($file['name']) ?> fa-fw"></i></td>
+                            <td>
+                                <?= $this->e($file['name']) ?>
+                            </td><td>
+                                <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'])) ?>
+                                    <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>
+                            </td></tr>
+                    <?php endforeach ?>
+                </table>
         </div>
     <?php endif
     ?>
-- 
cgit v1.2.3