Add web notifications
This commit is contained in:
61
app/Template/app/notifications.php
Normal file
61
app/Template/app/notifications.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<div class="page-header">
|
||||
<h2><?= t('My notifications') ?></h2>
|
||||
|
||||
<?php if (empty($notifications)): ?>
|
||||
<p class="alert"><?= t('No new notifications.') ?></p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<ul>
|
||||
<li>
|
||||
<i class="fa fa-check-square-o fa-fw"></i>
|
||||
<?= $this->url->link(t('Mark all as read'), 'webnotification', 'flush', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<table class="table-fixed table-small">
|
||||
<tr>
|
||||
<th><?= t('Notification') ?></th>
|
||||
<th class="column-20"><?= t('Date') ?></th>
|
||||
<th class="column-15"><?= t('Action') ?></th>
|
||||
</tr>
|
||||
<?php foreach ($notifications as $notification): ?>
|
||||
<tr>
|
||||
<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'], 'comment')): ?>
|
||||
<?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id']), false, '', '', false, 'comment-'.$notification['event_data']['comment']['id']) ?>
|
||||
<?php elseif ($this->text->contains($notification['event_name'], 'task.overdue')): ?>
|
||||
<?php if (count($notification['event_data']['tasks']) > 1): ?>
|
||||
<?= $notification['title'] ?>
|
||||
<?php else: ?>
|
||||
<?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['tasks'][0]['id'], 'project_id' => $notification['event_data']['tasks'][0]['project_id'])) ?>
|
||||
<?php endif ?>
|
||||
<?php else: ?>
|
||||
<?= $this->url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id'])) ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= dt('%B %e, %Y at %k:%M %p', $notification['date_creation']) ?>
|
||||
</td>
|
||||
<td>
|
||||
<i class="fa fa-check fa-fw"></i>
|
||||
<?= $this->url->link(t('Mark as read'), 'webnotification', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
<?php endif ?>
|
||||
@@ -19,6 +19,9 @@
|
||||
<li <?= $this->app->getRouterAction() === 'activity' ? 'class="active"' : '' ?>>
|
||||
<?= $this->url->link(t('My activity stream'), 'app', 'activity', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<li <?= $this->app->getRouterAction() === 'notifications' ? 'class="active"' : '' ?>>
|
||||
<?= $this->url->link(t('My notifications'), 'app', 'notifications', array('user_id' => $user['id'])) ?>
|
||||
</li>
|
||||
<?= $this->hook->render('template:dashboard:sidebar') ?>
|
||||
</ul>
|
||||
<div class="sidebar-collapse"><a href="#" title="<?= t('Hide sidebar') ?>"><i class="fa fa-chevron-left"></i></a></div>
|
||||
|
||||
Reference in New Issue
Block a user