From 9b399951f430b26379a2bf8b13ace99290227e61 Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Sun, 14 Jun 2015 11:50:31 -0400
Subject: Improve activity stream/notification for task update events and add
new notification for swimlane change
---
app/Template/event/events.php | 2 +
app/Template/event/task_move_swimlane.php | 19 ++++++
app/Template/event/task_update.php | 5 ++
app/Template/notification/task_move_swimlane.php | 19 ++++++
app/Template/notification/task_update.php | 63 +------------------
app/Template/task/changes.php | 78 ++++++++++++++++++++++++
6 files changed, 124 insertions(+), 62 deletions(-)
create mode 100644 app/Template/event/task_move_swimlane.php
create mode 100644 app/Template/notification/task_move_swimlane.php
create mode 100644 app/Template/task/changes.php
(limited to 'app/Template')
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 @@
text->contains($event['event_name'], 'subtask')): ?>
+ text->contains($event['event_name'], 'task.move')): ?>
+
text->contains($event['event_name'], 'task')): ?>
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) ?>
+
+
+
+ = 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']))
+ ) ?>
+
+ = 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'])
+ ) ?>
+
+
+
+ = $this->e($task['title']) ?>
+
\ 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 @@
= $this->e($task['title']) ?>
+
+
+ = $this->render('task/changes', array('changes' => $changes, 'task' => $task)) ?>
+
+
\ 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 @@
+= $this->e($task['title']) ?> (#= $task['id'] ?>)
+
+
+ -
+
+ = t('The task have been moved to the first swimlane') ?>
+
+ = t('The task have been moved to another swimlane:') ?>
+ = $this->e($task['swimlane_name']) ?>
+
+
+ -
+ = t('Column on the board:') ?>
+ = $this->e($task['column_title']) ?>
+
+ - = t('Task position:').' '.$this->e($task['position']) ?>
+
+
+= $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 @@
= $this->e($task['title']) ?> (#= $task['id'] ?>)
-= t('The task have been updated.') ?>
-
-
- = t('List of changes') ?>
-
- $value) {
-
- switch ($field) {
- case 'title':
- echo '- '.t('New title: %s', $task['title']).'
';
- break;
- case 'owner_id':
- if (empty($task['owner_id'])) {
- echo '- '.t('The task is not assigned anymore').'
';
- }
- else {
- echo '- '.t('New assignee: %s', $task['assignee_name'] ?: $task['assignee_username']).'
';
- }
- break;
- case 'category_id':
- if (empty($task['category_id'])) {
- echo '- '.t('There is no category now').'
';
- }
- else {
- echo '- '.t('New category: %s', $task['category_name']).'
';
- }
- break;
- case 'color_id':
- echo '- '.t('New color: %s', $this->text->in($task['color_id'], $colors_list)).'
';
- break;
- case 'score':
- echo '- '.t('New complexity: %d', $task['score']).'
';
- break;
- case 'date_due':
- if (empty($task['date_due'])) {
- echo '- '.t('The due date have been removed').'
';
- }
- else {
- echo '- '.dt('New due date: %B %e, %Y', $task['date_due']).'
';
- }
- break;
- case 'description':
- if (empty($task['description'])) {
- echo '- '.t('There is no description anymore').'
';
- }
- break;
- default:
- echo '- '.t('The field "%s" have been updated', $field).'
';
- }
- }
-
- ?>
-
-
-
- = t('New description') ?>
- = $this->text->markdown($task['description']) ?>
-
-
-
+= $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 @@
+
+
+ $value) {
+
+ switch ($field) {
+ case 'title':
+ echo '- '.t('New title: %s', $task['title']).'
';
+ break;
+ case 'owner_id':
+ if (empty($task['owner_id'])) {
+ echo '- '.t('The task is not assigned anymore').'
';
+ }
+ else {
+ echo '- '.t('New assignee: %s', $task['assignee_name'] ?: $task['assignee_username']).'
';
+ }
+ break;
+ case 'category_id':
+ if (empty($task['category_id'])) {
+ echo '- '.t('There is no category now').'
';
+ }
+ else {
+ echo '- '.t('New category: %s', $task['category_name']).'
';
+ }
+ break;
+ case 'color_id':
+ echo '- '.t('New color: %s', $this->text->in($task['color_id'], $this->task->getColors())).'
';
+ break;
+ case 'score':
+ echo '- '.t('New complexity: %d', $task['score']).'
';
+ break;
+ case 'date_due':
+ if (empty($task['date_due'])) {
+ echo '- '.t('The due date have been removed').'
';
+ }
+ else {
+ echo '- '.dt('New due date: %B %e, %Y', $task['date_due']).'
';
+ }
+ break;
+ case 'description':
+ if (empty($task['description'])) {
+ echo '- '.t('There is no description anymore').'
';
+ }
+ break;
+ case 'recurrence_status':
+ case 'recurrence_trigger':
+ case 'recurrence_factor':
+ case 'recurrence_timeframe':
+ case 'recurrence_basedate':
+ case 'recurrence_parent':
+ case 'recurrence_child':
+ echo '- '.t('Recurrence settings have been modified').'
';
+ break;
+ case 'time_spent':
+ echo '- '.t('Time spent changed: %sh', $task['time_spent']).'
';
+ break;
+ case 'time_estimated':
+ echo '- '.t('Time estimated changed: %sh', $task['time_estimated']).'
';
+ break;
+ case 'date_started':
+ if ($value != 0) {
+ echo '- '.dt('Start date changed: %B %e, %Y', $task['date_started']).'
';
+ }
+ break;
+ default:
+ echo '- '.t('The field "%s" have been updated', $field).'
';
+ }
+ }
+
+ ?>
+
+
+
+ = t('The description have been modified') ?>
+ = $this->text->markdown($task['description']) ?>
+
+
\ No newline at end of file
--
cgit v1.2.3