diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-06-14 11:50:31 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-06-14 11:50:31 -0400 |
commit | 9b399951f430b26379a2bf8b13ace99290227e61 (patch) | |
tree | 4dd694985dc9f27782ad365d376dc5a37f1e987e /app/Template | |
parent | a785810f2d11ad14ab3497a51ca10a6780b758ad (diff) |
Improve activity stream/notification for task update events and add new notification for swimlane change
Diffstat (limited to 'app/Template')
-rw-r--r-- | app/Template/event/events.php | 2 | ||||
-rw-r--r-- | app/Template/event/task_move_swimlane.php | 19 | ||||
-rw-r--r-- | app/Template/event/task_update.php | 5 | ||||
-rw-r--r-- | app/Template/notification/task_move_swimlane.php | 19 | ||||
-rw-r--r-- | app/Template/notification/task_update.php | 63 | ||||
-rw-r--r-- | app/Template/task/changes.php | 78 |
6 files changed, 124 insertions, 62 deletions
diff --git a/app/Template/event/events.php b/app/Template/event/events.php index 2dc79871..971f6587 100644 --- a/app/Template/event/events.php +++ b/app/Template/event/events.php @@ -7,6 +7,8 @@ <p class="activity-datetime"> <?php if ($this->text->contains($event['event_name'], 'subtask')): ?> <i class="fa fa-tasks"></i> + <?php elseif ($this->text->contains($event['event_name'], 'task.move')): ?> + <i class="fa fa-arrows-alt"></i> <?php elseif ($this->text->contains($event['event_name'], 'task')): ?> <i class="fa fa-newspaper-o"></i> <?php elseif ($this->text->contains($event['event_name'], 'comment')): ?> diff --git a/app/Template/event/task_move_swimlane.php b/app/Template/event/task_move_swimlane.php new file mode 100644 index 00000000..ca440dbf --- /dev/null +++ b/app/Template/event/task_move_swimlane.php @@ -0,0 +1,19 @@ +<?= $this->user->avatar($email, $author) ?> + +<p class="activity-title"> + <?php if ($task['swimlane_id'] == 0): ?> + <?= e('%s moved the task %s to the first swimlane', + $this->e($author), + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) + ) ?> + <?php else: ?> + <?= e('%s moved the task %s to the swimlane "%s"', + $this->e($author), + $this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), + $this->e($task['swimlane_name']) + ) ?> + <?php endif ?> +</p> +<p class="activity-description"> + <em><?= $this->e($task['title']) ?></em> +</p>
\ No newline at end of file diff --git a/app/Template/event/task_update.php b/app/Template/event/task_update.php index 7d036d43..e8254bcb 100644 --- a/app/Template/event/task_update.php +++ b/app/Template/event/task_update.php @@ -8,4 +8,9 @@ </p> <p class="activity-description"> <em><?= $this->e($task['title']) ?></em> + <?php if (isset($changes)): ?> + <div class="activity-changes"> + <?= $this->render('task/changes', array('changes' => $changes, 'task' => $task)) ?> + </div> + <?php endif ?> </p>
\ No newline at end of file diff --git a/app/Template/notification/task_move_swimlane.php b/app/Template/notification/task_move_swimlane.php new file mode 100644 index 00000000..04de7cc6 --- /dev/null +++ b/app/Template/notification/task_move_swimlane.php @@ -0,0 +1,19 @@ +<h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> + +<ul> + <li> + <?php if ($task['swimlane_id'] == 0): ?> + <?= t('The task have been moved to the first swimlane') ?> + <?php else: ?> + <?= t('The task have been moved to another swimlane:') ?> + <strong><?= $this->e($task['swimlane_name']) ?></strong> + <?php endif ?> + </li> + <li> + <?= t('Column on the board:') ?> + <strong><?= $this->e($task['column_title']) ?></strong> + </li> + <li><?= t('Task position:').' '.$this->e($task['position']) ?></li> +</ul> + +<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/notification/task_update.php b/app/Template/notification/task_update.php index 0352788b..54f5c6d1 100644 --- a/app/Template/notification/task_update.php +++ b/app/Template/notification/task_update.php @@ -1,65 +1,4 @@ <h2><?= $this->e($task['title']) ?> (#<?= $task['id'] ?>)</h2> -<?= t('The task have been updated.') ?> - -<?php if (! empty($changes)): ?> - <h2><?= t('List of changes') ?></h2> - <ul> - <?php - - foreach ($changes as $field => $value) { - - switch ($field) { - case 'title': - echo '<li>'.t('New title: %s', $task['title']).'</li>'; - break; - case 'owner_id': - if (empty($task['owner_id'])) { - echo '<li>'.t('The task is not assigned anymore').'</li>'; - } - else { - echo '<li>'.t('New assignee: %s', $task['assignee_name'] ?: $task['assignee_username']).'</li>'; - } - break; - case 'category_id': - if (empty($task['category_id'])) { - echo '<li>'.t('There is no category now').'</li>'; - } - else { - echo '<li>'.t('New category: %s', $task['category_name']).'</li>'; - } - break; - case 'color_id': - echo '<li>'.t('New color: %s', $this->text->in($task['color_id'], $colors_list)).'</li>'; - break; - case 'score': - echo '<li>'.t('New complexity: %d', $task['score']).'</li>'; - break; - case 'date_due': - if (empty($task['date_due'])) { - echo '<li>'.t('The due date have been removed').'</li>'; - } - else { - echo '<li>'.dt('New due date: %B %e, %Y', $task['date_due']).'</li>'; - } - break; - case 'description': - if (empty($task['description'])) { - echo '<li>'.t('There is no description anymore').'</li>'; - } - break; - default: - echo '<li>'.t('The field "%s" have been updated', $field).'</li>'; - } - } - - ?> - </ul> - - <?php if (! empty($changes['description'])): ?> - <h3><?= t('New description') ?></h3> - <?= $this->text->markdown($task['description']) ?> - <?php endif ?> -<?php endif ?> - +<?= $this->render('task/changes', array('changes' => $changes, 'task' => $task)) ?> <?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file diff --git a/app/Template/task/changes.php b/app/Template/task/changes.php new file mode 100644 index 00000000..c7fc0d52 --- /dev/null +++ b/app/Template/task/changes.php @@ -0,0 +1,78 @@ +<?php if (! empty($changes)): ?> + <ul> + <?php + + foreach ($changes as $field => $value) { + + switch ($field) { + case 'title': + echo '<li>'.t('New title: %s', $task['title']).'</li>'; + break; + case 'owner_id': + if (empty($task['owner_id'])) { + echo '<li>'.t('The task is not assigned anymore').'</li>'; + } + else { + echo '<li>'.t('New assignee: %s', $task['assignee_name'] ?: $task['assignee_username']).'</li>'; + } + break; + case 'category_id': + if (empty($task['category_id'])) { + echo '<li>'.t('There is no category now').'</li>'; + } + else { + echo '<li>'.t('New category: %s', $task['category_name']).'</li>'; + } + break; + case 'color_id': + echo '<li>'.t('New color: %s', $this->text->in($task['color_id'], $this->task->getColors())).'</li>'; + break; + case 'score': + echo '<li>'.t('New complexity: %d', $task['score']).'</li>'; + break; + case 'date_due': + if (empty($task['date_due'])) { + echo '<li>'.t('The due date have been removed').'</li>'; + } + else { + echo '<li>'.dt('New due date: %B %e, %Y', $task['date_due']).'</li>'; + } + break; + case 'description': + if (empty($task['description'])) { + echo '<li>'.t('There is no description anymore').'</li>'; + } + break; + case 'recurrence_status': + case 'recurrence_trigger': + case 'recurrence_factor': + case 'recurrence_timeframe': + case 'recurrence_basedate': + case 'recurrence_parent': + case 'recurrence_child': + echo '<li>'.t('Recurrence settings have been modified').'</li>'; + break; + case 'time_spent': + echo '<li>'.t('Time spent changed: %sh', $task['time_spent']).'</li>'; + break; + case 'time_estimated': + echo '<li>'.t('Time estimated changed: %sh', $task['time_estimated']).'</li>'; + break; + case 'date_started': + if ($value != 0) { + echo '<li>'.dt('Start date changed: %B %e, %Y', $task['date_started']).'</li>'; + } + break; + default: + echo '<li>'.t('The field "%s" have been updated', $field).'</li>'; + } + } + + ?> + </ul> + + <?php if (! empty($changes['description'])): ?> + <p><?= t('The description have been modified') ?></p> + <div class="markdown"><?= $this->text->markdown($task['description']) ?></div> + <?php endif ?> +<?php endif ?>
\ No newline at end of file |