summaryrefslogtreecommitdiff
path: root/app/Template/task_file
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-03-18 21:00:14 -0400
committerFrederic Guillot <fred@kanboard.net>2016-03-18 21:00:14 -0400
commit854457baf0043b51ce9c30f36a6fecaed97cb04d (patch)
tree0f73023f63654ee7313ac79e83d9d19e58658a1a /app/Template/task_file
parent68fba8fb64afe00aedccdf72f25d79b26356f2ab (diff)
Improve task summary sections
Diffstat (limited to 'app/Template/task_file')
-rw-r--r--app/Template/task_file/files.php47
-rw-r--r--app/Template/task_file/images.php34
-rw-r--r--app/Template/task_file/show.php97
3 files changed, 89 insertions, 89 deletions
diff --git a/app/Template/task_file/files.php b/app/Template/task_file/files.php
new file mode 100644
index 00000000..5603014e
--- /dev/null
+++ b/app/Template/task_file/files.php
@@ -0,0 +1,47 @@
+<?php if (! empty($files)): ?>
+ <table class="table-stripped table-small">
+ <tr>
+ <th><?= t('Filename') ?></th>
+ <th><?= t('Creator') ?></th>
+ <th><?= t('Date') ?></th>
+ <th><?= t('Size') ?></th>
+ </tr>
+ <?php foreach ($files as $file): ?>
+ <tr>
+ <td>
+ <i class="fa <?= $this->file->icon($file['name']) ?> fa-fw"></i>
+ <div class="dropdown">
+ <a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->text->e($file['name']) ?> <i class="fa fa-caret-down"></i></a>
+ <ul>
+ <?php if ($this->file->getPreviewType($file['name']) !== null): ?>
+ <li>
+ <i class="fa fa-eye fa-fw"></i>
+ <?= $this->url->link(t('View file'), '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>
+ <td>
+ <?= $this->text->e($file['user_name'] ?: $file['username']) ?>
+ </td>
+ <td>
+ <?= $this->dt->date($file['date']) ?>
+ </td>
+ <td>
+ <?= $this->text->bytes($file['size']) ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+<?php endif ?> \ No newline at end of file
diff --git a/app/Template/task_file/images.php b/app/Template/task_file/images.php
new file mode 100644
index 00000000..55c098cb
--- /dev/null
+++ b/app/Template/task_file/images.php
@@ -0,0 +1,34 @@
+<?php if (! empty($images)): ?>
+ <div class="file-thumbnails">
+ <?php foreach ($images as $file): ?>
+ <div class="file-thumbnail">
+ <a href="<?= $this->url->href('FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewer', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->text->e($file['name']) ?>" alt="<?= $this->text->e($file['name']) ?>"></a>
+ <div class="file-thumbnail-content">
+ <div class="file-thumbnail-title">
+ <div class="dropdown">
+ <a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->text->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 ?>
+ </ul>
+ </div>
+ </div>
+ <div class="file-thumbnail-description">
+ <span class="tooltip" title='<?= t('Uploaded: %s', $this->dt->datetime($file['date'])).'<br>'.t('Size: %s', $this->text->bytes($file['size'])) ?>'>
+ <i class="fa fa-info-circle"></i>
+ </span>
+ <?= t('Uploaded by %s', $file['user_name'] ?: $file['username']) ?>
+ </div>
+ </div>
+ </div>
+ <?php endforeach ?>
+ </div>
+<?php endif ?> \ No newline at end of file
diff --git a/app/Template/task_file/show.php b/app/Template/task_file/show.php
index 21bf79ef..df69605d 100644
--- a/app/Template/task_file/show.php
+++ b/app/Template/task_file/show.php
@@ -1,90 +1,9 @@
-<?php if (! empty($files) || ! empty($images)): ?>
-<div id="attachments" class="task-show-section">
-
- <div class="page-header">
- <h2><?= t('Attachments') ?></h2>
+<section class="accordion-section <?= empty($files) && empty($images) ? 'accordion-collapsed' : '' ?>">
+ <div class="accordion-title">
+ <h3><a href="#" class="fa accordion-toggle"></a> <?= t('Attachments') ?></h3>
</div>
- <?php if (! empty($images)): ?>
- <div class="file-thumbnails">
- <?php foreach ($images as $file): ?>
- <div class="file-thumbnail">
- <a href="<?= $this->url->href('FileViewer', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('FileViewer', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->text->e($file['name']) ?>" alt="<?= $this->text->e($file['name']) ?>"></a>
- <div class="file-thumbnail-content">
- <div class="file-thumbnail-title">
- <div class="dropdown">
- <a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->text->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 ?>
- </ul>
- </div>
- </div>
- <div class="file-thumbnail-description">
- <span class="tooltip" title='<?= t('Uploaded: %s', $this->dt->datetime($file['date'])).'<br>'.t('Size: %s', $this->text->bytes($file['size'])) ?>'>
- <i class="fa fa-info-circle"></i>
- </span>
- <?= t('Uploaded by %s', $file['user_name'] ?: $file['username']) ?>
- </div>
- </div>
- </div>
- <?php endforeach ?>
- </div>
- <?php endif ?>
-
- <?php if (! empty($files)): ?>
- <table class="table-stripped">
- <tr>
- <th><?= t('Filename') ?></th>
- <th><?= t('Creator') ?></th>
- <th><?= t('Date') ?></th>
- <th><?= t('Size') ?></th>
- </tr>
- <?php foreach ($files as $file): ?>
- <tr>
- <td>
- <i class="fa <?= $this->file->icon($file['name']) ?> fa-fw"></i>
- <div class="dropdown">
- <a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->text->e($file['name']) ?> <i class="fa fa-caret-down"></i></a>
- <ul>
- <?php if ($this->file->getPreviewType($file['name']) !== null): ?>
- <li>
- <i class="fa fa-eye fa-fw"></i>
- <?= $this->url->link(t('View file'), '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>
- <td>
- <?= $this->text->e($file['user_name'] ?: $file['username']) ?>
- </td>
- <td>
- <?= $this->dt->date($file['date']) ?>
- </td>
- <td>
- <?= $this->text->bytes($file['size']) ?>
- </td>
- </tr>
- <?php endforeach ?>
- </table>
- <?php endif ?>
-</div>
-<?php endif ?> \ No newline at end of file
+ <div class="accordion-content">
+ <?= $this->render('task_file/images', array('task' => $task, 'images' => $images)) ?>
+ <?= $this->render('task_file/files', array('task' => $task, 'files' => $files)) ?>
+ </div>
+</section>