summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-03-11 19:01:40 -0500
committerFrederic Guillot <fred@kanboard.net>2017-03-11 19:01:40 -0500
commitcfd3000d833d3a99df0b4248e3b6160e9be4f22a (patch)
tree2a4ccff357a394670a49fd4447f3ebaee637b667 /app/Template
parentbb9e7916574bd7e21550bf7505757fccae6cbdd0 (diff)
Move notifications outside of dashboard
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/dashboard/notifications.php67
-rw-r--r--app/Template/dashboard/sidebar.php3
-rw-r--r--app/Template/header/user_notifications.php8
-rw-r--r--app/Template/web_notification/show.php68
4 files changed, 73 insertions, 73 deletions
diff --git a/app/Template/dashboard/notifications.php b/app/Template/dashboard/notifications.php
deleted file mode 100644
index 81adb348..00000000
--- a/app/Template/dashboard/notifications.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<div class="page-header">
- <h2><?= t('My notifications') ?></h2>
-
-<?php if (empty($notifications)): ?>
-</div>
-<p class="alert"><?= t('No new notifications.') ?></p>
-<?php else: ?>
- <ul>
- <li>
- <?= $this->url->icon('check-square-o', t('Mark all as read'), 'WebNotificationController', 'flush', array('user_id' => $user['id'])) ?>
- </li>
- </ul>
-</div>
-
- <table class="table-striped table-scrolling table-small">
- <tr>
- <th class="column-20"><?= t('Project') ?></th>
- <th><?= t('Notification') ?></th>
- <th class="column-15"><?= t('Date') ?></th>
- <th class="column-15"><?= t('Action') ?></th>
- </tr>
- <?php foreach ($notifications as $notification): ?>
- <tr>
- <td>
- <?php if (isset($notification['event_data']['task']['project_name'])): ?>
- <?= $this->url->link(
- $this->text->e($notification['event_data']['task']['project_name']),
- 'BoardViewController',
- 'show',
- array('project_id' => $notification['event_data']['task']['project_id'])
- )
- ?>
- <?php elseif (isset($notification['event_data']['project_name'])): ?>
- <?= $this->text->e($notification['event_data']['project_name']) ?>
- <?php endif ?>
- </td>
- <td>
- <?php if ($this->text->contains($notification['event_name'], 'subtask')): ?>
- <i class="fa fa-tasks fa-fw"></i>
- <?php elseif ($this->text->contains($notification['event_name'], 'task.move')): ?>
- <i class="fa fa-arrows-alt fa-fw"></i>
- <?php elseif ($this->text->contains($notification['event_name'], 'task.overdue')): ?>
- <i class="fa fa-calendar-times-o fa-fw"></i>
- <?php elseif ($this->text->contains($notification['event_name'], 'task')): ?>
- <i class="fa fa-newspaper-o fa-fw"></i>
- <?php elseif ($this->text->contains($notification['event_name'], 'comment')): ?>
- <i class="fa fa-comments-o fa-fw"></i>
- <?php elseif ($this->text->contains($notification['event_name'], 'file')): ?>
- <i class="fa fa-file-o fa-fw"></i>
- <?php endif ?>
-
- <?php if ($this->text->contains($notification['event_name'], 'task.overdue') && count($notification['event_data']['tasks']) > 1): ?>
- <?= $notification['title'] ?>
- <?php else: ?>
- <?= $this->url->link($notification['title'], 'WebNotificationController', 'redirect', array('notification_id' => $notification['id'], 'user_id' => $user['id'])) ?>
- <?php endif ?>
- </td>
- <td>
- <?= $this->dt->datetime($notification['date_creation']) ?>
- </td>
- <td>
- <?= $this->url->icon('check', t('Mark as read'), 'WebNotificationController', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?>
- </td>
- </tr>
- <?php endforeach ?>
- </table>
-<?php endif ?>
diff --git a/app/Template/dashboard/sidebar.php b/app/Template/dashboard/sidebar.php
index 108c028a..e4c1038a 100644
--- a/app/Template/dashboard/sidebar.php
+++ b/app/Template/dashboard/sidebar.php
@@ -18,9 +18,6 @@
<li <?= $this->app->checkMenuSelection('DashboardController', 'activity') ?>>
<?= $this->url->link(t('My activity stream'), 'DashboardController', 'activity', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->checkMenuSelection('DashboardController', 'notifications') ?>>
- <?= $this->url->link(t('My notifications'), 'DashboardController', 'notifications', array('user_id' => $user['id'])) ?>
- </li>
<?= $this->hook->render('template:dashboard:sidebar', array('user' => $user)) ?>
</ul>
</div>
diff --git a/app/Template/header/user_notifications.php b/app/Template/header/user_notifications.php
index 83c545d2..036fee29 100644
--- a/app/Template/header/user_notifications.php
+++ b/app/Template/header/user_notifications.php
@@ -1,5 +1,7 @@
+<span class="notification">
<?php if ($this->user->hasNotifications()): ?>
- <span class="notification">
- <?= $this->url->link('<i class="fa fa-bell web-notification-icon"></i>', 'DashboardController', 'notifications', array('user_id' => $this->user->getId()), false, '', t('Unread notifications')) ?>
- </span>
+ <?= $this->modal->mediumIcon('bell web-notification-icon', t('Unread notifications'), 'WebNotificationController', 'show', array('user_id' => $this->user->getId())) ?>
+<?php else: ?>
+ <?= $this->modal->mediumIcon('bell', t('My notifications'), 'WebNotificationController', 'show', array('user_id' => $this->user->getId())) ?>
<?php endif ?>
+</span>
diff --git a/app/Template/web_notification/show.php b/app/Template/web_notification/show.php
new file mode 100644
index 00000000..d4f22ade
--- /dev/null
+++ b/app/Template/web_notification/show.php
@@ -0,0 +1,68 @@
+<div class="page-header">
+ <h2><?= t('My notifications') ?></h2>
+
+ <?php if (! empty($notifications)): ?>
+ <ul>
+ <li>
+ <?= $this->modal->replaceIconLink('check-square-o', t('Mark all as read'), 'WebNotificationController', 'flush', array('user_id' => $user['id'])) ?>
+ </li>
+ </ul>
+ <?php endif ?>
+</div>
+
+<?php if (empty($notifications)): ?>
+ <p class="alert"><?= t('No notification.') ?></p>
+<?php else: ?>
+<div class="table-list">
+ <div class="table-list-header">
+ <div class="table-list-header-count">
+ <?php if ($nb_notifications > 1): ?>
+ <?= t('%d notifications', $nb_notifications) ?>
+ <?php else: ?>
+ <?= t('%d notification', $nb_notifications) ?>
+ <?php endif ?>
+ </div>
+ &nbsp;
+ </div>
+ <?php foreach ($notifications as $notification): ?>
+ <div class="table-list-row table-border-left">
+ <span class="table-list-title">
+ <?php if ($this->text->contains($notification['event_name'], 'subtask')): ?>
+ <i class="fa fa-tasks fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'task.move')): ?>
+ <i class="fa fa-arrows-alt fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'task.overdue')): ?>
+ <i class="fa fa-calendar-times-o fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'task')): ?>
+ <i class="fa fa-newspaper-o fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'comment')): ?>
+ <i class="fa fa-comments-o fa-fw"></i>
+ <?php elseif ($this->text->contains($notification['event_name'], 'file')): ?>
+ <i class="fa fa-file-o fa-fw"></i>
+ <?php endif ?>
+
+ <?php if (isset($notification['event_data']['task']['project_name'])): ?>
+ <?= $this->url->link(
+ $this->text->e($notification['event_data']['task']['project_name']),
+ 'BoardViewController',
+ 'show',
+ array('project_id' => $notification['event_data']['task']['project_id'])
+ ) ?> &gt;
+ <?php elseif (isset($notification['event_data']['project_name'])): ?>
+ <?= $this->text->e($notification['event_data']['project_name']) ?> &gt;
+ <?php endif ?>
+
+ <?php if ($this->text->contains($notification['event_name'], 'task.overdue') && count($notification['event_data']['tasks']) > 1): ?>
+ <?= $notification['title'] ?>
+ <?php else: ?>
+ <?= $this->url->link($notification['title'], 'WebNotificationController', 'redirect', array('notification_id' => $notification['id'], 'user_id' => $user['id'])) ?>
+ <?php endif ?>
+ </span>
+ <div class="table-list-details">
+ <?= $this->dt->datetime($notification['date_creation']) ?>
+ <?= $this->modal->replaceIconLink('check', t('Mark as read'), 'WebNotificationController', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?>
+ </div>
+ </div>
+ <?php endforeach ?>
+</div>
+<?php endif ?> \ No newline at end of file