From 67b836164997527b91452b19adbcb8aa3c5decf1 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 15 May 2016 18:31:47 -0400 Subject: Refactoring: added controlled middleware and changed response class --- app/Template/app/activity.php | 4 --- app/Template/app/calendar.php | 5 --- app/Template/app/layout.php | 32 ----------------- app/Template/app/notifications.php | 61 -------------------------------- app/Template/app/overview.php | 12 ------- app/Template/app/projects.php | 50 -------------------------- app/Template/app/sidebar.php | 27 -------------- app/Template/app/subtasks.php | 43 ---------------------- app/Template/app/tasks.php | 49 ------------------------- app/Template/config/application.php | 2 +- app/Template/config/board.php | 2 +- app/Template/config/calendar.php | 4 +-- app/Template/config/integrations.php | 4 +-- app/Template/config/layout.php | 3 +- app/Template/config/project.php | 2 +- app/Template/config/webhook.php | 4 +-- app/Template/dashboard/activity.php | 4 +++ app/Template/dashboard/calendar.php | 5 +++ app/Template/dashboard/layout.php | 32 +++++++++++++++++ app/Template/dashboard/notifications.php | 61 ++++++++++++++++++++++++++++++++ app/Template/dashboard/projects.php | 50 ++++++++++++++++++++++++++ app/Template/dashboard/show.php | 12 +++++++ app/Template/dashboard/sidebar.php | 27 ++++++++++++++ app/Template/dashboard/subtasks.php | 43 ++++++++++++++++++++++ app/Template/dashboard/tasks.php | 49 +++++++++++++++++++++++++ app/Template/header.php | 6 ++-- app/Template/layout.php | 2 +- app/Template/user/sidebar.php | 4 +-- 28 files changed, 299 insertions(+), 300 deletions(-) delete mode 100644 app/Template/app/activity.php delete mode 100644 app/Template/app/calendar.php delete mode 100644 app/Template/app/layout.php delete mode 100644 app/Template/app/notifications.php delete mode 100644 app/Template/app/overview.php delete mode 100644 app/Template/app/projects.php delete mode 100644 app/Template/app/sidebar.php delete mode 100644 app/Template/app/subtasks.php delete mode 100644 app/Template/app/tasks.php create mode 100644 app/Template/dashboard/activity.php create mode 100644 app/Template/dashboard/calendar.php create mode 100644 app/Template/dashboard/layout.php create mode 100644 app/Template/dashboard/notifications.php create mode 100644 app/Template/dashboard/projects.php create mode 100644 app/Template/dashboard/show.php create mode 100644 app/Template/dashboard/sidebar.php create mode 100644 app/Template/dashboard/subtasks.php create mode 100644 app/Template/dashboard/tasks.php (limited to 'app/Template') diff --git a/app/Template/app/activity.php b/app/Template/app/activity.php deleted file mode 100644 index 71a67fb2..00000000 --- a/app/Template/app/activity.php +++ /dev/null @@ -1,4 +0,0 @@ - -render('event/events', array('events' => $events)) ?> \ No newline at end of file diff --git a/app/Template/app/calendar.php b/app/Template/app/calendar.php deleted file mode 100644 index a154203b..00000000 --- a/app/Template/app/calendar.php +++ /dev/null @@ -1,5 +0,0 @@ -
-
diff --git a/app/Template/app/layout.php b/app/Template/app/layout.php deleted file mode 100644 index 2a32ac02..00000000 --- a/app/Template/app/layout.php +++ /dev/null @@ -1,32 +0,0 @@ -
- - -
\ No newline at end of file diff --git a/app/Template/app/notifications.php b/app/Template/app/notifications.php deleted file mode 100644 index b64eb0b7..00000000 --- a/app/Template/app/notifications.php +++ /dev/null @@ -1,61 +0,0 @@ - -

- - - - - - - - - - - - - - - - - -
- text->contains($notification['event_name'], 'subtask')): ?> - - text->contains($notification['event_name'], 'task.move')): ?> - - text->contains($notification['event_name'], 'task.overdue')): ?> - - text->contains($notification['event_name'], 'task')): ?> - - text->contains($notification['event_name'], 'comment')): ?> - - text->contains($notification['event_name'], 'file')): ?> - - - - text->contains($notification['event_name'], 'comment')): ?> - 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']) ?> - text->contains($notification['event_name'], 'task.overdue')): ?> - 1): ?> - - - url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['tasks'][0]['id'], 'project_id' => $notification['event_data']['tasks'][0]['project_id'])) ?> - - - url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id'])) ?> - - - dt->datetime($notification['date_creation']) ?> - - - url->link(t('Mark as read'), 'webNotification', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?> -
- \ No newline at end of file diff --git a/app/Template/app/overview.php b/app/Template/app/overview.php deleted file mode 100644 index 0b354791..00000000 --- a/app/Template/app/overview.php +++ /dev/null @@ -1,12 +0,0 @@ -
- -
- -render('app/projects', array('paginator' => $project_paginator, 'user' => $user)) ?> -render('app/tasks', array('paginator' => $task_paginator, 'user' => $user)) ?> -render('app/subtasks', array('paginator' => $subtask_paginator, 'user' => $user)) ?> \ No newline at end of file diff --git a/app/Template/app/projects.php b/app/Template/app/projects.php deleted file mode 100644 index c0110b07..00000000 --- a/app/Template/app/projects.php +++ /dev/null @@ -1,50 +0,0 @@ - -isEmpty()): ?> -

- - - - - - - - - getCollection() as $project): ?> - - - - - - - -
order('Id', 'id') ?>order('', 'is_private') ?>order(t('Project'), \Kanboard\Model\Project::TABLE.'.name') ?>
- render('project/dropdown', array('project' => $project)) ?> - - - - - - user->hasProjectAccess('gantt', 'project', $project['id'])): ?> - url->link('', 'gantt', 'project', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?> - - - url->link('', 'listing', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('List')) ?>  - url->link('', 'calendar', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?>  - - url->link($this->text->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> - - - - - - - - - text->e($column['title']) ?> - -
- - - diff --git a/app/Template/app/sidebar.php b/app/Template/app/sidebar.php deleted file mode 100644 index 66d15b14..00000000 --- a/app/Template/app/sidebar.php +++ /dev/null @@ -1,27 +0,0 @@ - \ No newline at end of file diff --git a/app/Template/app/subtasks.php b/app/Template/app/subtasks.php deleted file mode 100644 index cca09481..00000000 --- a/app/Template/app/subtasks.php +++ /dev/null @@ -1,43 +0,0 @@ - -isEmpty()): ?> -

- - - - - - - - - - getCollection() as $subtask): ?> - - - - - - - - -
order('Id', 'tasks.id') ?>order(t('Project'), 'project_name') ?>order(t('Task'), 'task_name') ?>order(t('Subtask'), 'title') ?>
- render('task/dropdown', array('task' => array('id' => $subtask['task_id'], 'project_id' => $subtask['project_id']))) ?> - - url->link($this->text->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> - - url->link($this->text->e($subtask['task_name']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> - - subtask->toggleStatus($subtask, $subtask['project_id']) ?> - - - text->e($subtask['time_spent']).'h' ?> - - - - text->e($subtask['time_estimated']).'h' ?> - -
- - - \ No newline at end of file diff --git a/app/Template/app/tasks.php b/app/Template/app/tasks.php deleted file mode 100644 index f0ed61e0..00000000 --- a/app/Template/app/tasks.php +++ /dev/null @@ -1,49 +0,0 @@ - -isEmpty()): ?> -

- - - - - - - - - - - getCollection() as $task): ?> - - - - - - - - - -
order('Id', 'tasks.id') ?>order(t('Project'), 'project_name') ?>order(t('Task'), 'title') ?>order('Priority', 'tasks.priority') ?>order(t('Due date'), 'date_due') ?>
- render('task/dropdown', array('task' => $task)) ?> - - url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> - - url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> - - = 0): ?> - Ptext->e($task['priority'])?> - - - - text->e($task['time_spent']).'h' ?> - - - - text->e($task['time_estimated']).'h' ?> - - - dt->date($task['date_due']) ?> -
- - - diff --git a/app/Template/config/application.php b/app/Template/config/application.php index 259756bc..ee0e147b 100644 --- a/app/Template/config/application.php +++ b/app/Template/config/application.php @@ -1,7 +1,7 @@ -
+ form->csrf() ?> diff --git a/app/Template/config/board.php b/app/Template/config/board.php index ba1bab59..75cd40ef 100644 --- a/app/Template/config/board.php +++ b/app/Template/config/board.php @@ -1,7 +1,7 @@ - + form->csrf() ?> diff --git a/app/Template/config/calendar.php b/app/Template/config/calendar.php index b7b230df..37084a8b 100644 --- a/app/Template/config/calendar.php +++ b/app/Template/config/calendar.php @@ -2,7 +2,7 @@

- + form->csrf() ?> @@ -31,4 +31,4 @@ -
\ No newline at end of file + diff --git a/app/Template/config/integrations.php b/app/Template/config/integrations.php index e404c52e..2a29b358 100644 --- a/app/Template/config/integrations.php +++ b/app/Template/config/integrations.php @@ -2,7 +2,7 @@

-
+ form->csrf() ?> hook->render('template:config:integrations', array('values' => $values)) ?> @@ -14,4 +14,4 @@
-
\ No newline at end of file + diff --git a/app/Template/config/layout.php b/app/Template/config/layout.php index f34caaab..6eafa593 100644 --- a/app/Template/config/layout.php +++ b/app/Template/config/layout.php @@ -1,10 +1,9 @@
-
\ No newline at end of file + diff --git a/app/Template/config/project.php b/app/Template/config/project.php index b6b7ec25..b0112773 100644 --- a/app/Template/config/project.php +++ b/app/Template/config/project.php @@ -1,7 +1,7 @@ -
+ form->csrf() ?> diff --git a/app/Template/config/webhook.php b/app/Template/config/webhook.php index b96979a0..5db1fa6e 100644 --- a/app/Template/config/webhook.php +++ b/app/Template/config/webhook.php @@ -2,7 +2,7 @@

- + form->csrf() ?> @@ -32,4 +32,4 @@ url->link(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?> -
\ No newline at end of file + diff --git a/app/Template/dashboard/activity.php b/app/Template/dashboard/activity.php new file mode 100644 index 00000000..71a67fb2 --- /dev/null +++ b/app/Template/dashboard/activity.php @@ -0,0 +1,4 @@ + +render('event/events', array('events' => $events)) ?> \ No newline at end of file diff --git a/app/Template/dashboard/calendar.php b/app/Template/dashboard/calendar.php new file mode 100644 index 00000000..a154203b --- /dev/null +++ b/app/Template/dashboard/calendar.php @@ -0,0 +1,5 @@ +
+
diff --git a/app/Template/dashboard/layout.php b/app/Template/dashboard/layout.php new file mode 100644 index 00000000..2a32ac02 --- /dev/null +++ b/app/Template/dashboard/layout.php @@ -0,0 +1,32 @@ +
+ + +
\ No newline at end of file diff --git a/app/Template/dashboard/notifications.php b/app/Template/dashboard/notifications.php new file mode 100644 index 00000000..b64eb0b7 --- /dev/null +++ b/app/Template/dashboard/notifications.php @@ -0,0 +1,61 @@ + +

+ + + + + + + + + + + + + + + + + +
+ text->contains($notification['event_name'], 'subtask')): ?> + + text->contains($notification['event_name'], 'task.move')): ?> + + text->contains($notification['event_name'], 'task.overdue')): ?> + + text->contains($notification['event_name'], 'task')): ?> + + text->contains($notification['event_name'], 'comment')): ?> + + text->contains($notification['event_name'], 'file')): ?> + + + + text->contains($notification['event_name'], 'comment')): ?> + 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']) ?> + text->contains($notification['event_name'], 'task.overdue')): ?> + 1): ?> + + + url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['tasks'][0]['id'], 'project_id' => $notification['event_data']['tasks'][0]['project_id'])) ?> + + + url->link($notification['title'], 'task', 'show', array('task_id' => $notification['event_data']['task']['id'], 'project_id' => $notification['event_data']['task']['project_id'])) ?> + + + dt->datetime($notification['date_creation']) ?> + + + url->link(t('Mark as read'), 'webNotification', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?> +
+ \ No newline at end of file diff --git a/app/Template/dashboard/projects.php b/app/Template/dashboard/projects.php new file mode 100644 index 00000000..cdf19bdf --- /dev/null +++ b/app/Template/dashboard/projects.php @@ -0,0 +1,50 @@ + +isEmpty()): ?> +

+ + + + + + + + + getCollection() as $project): ?> + + + + + + + +
order('Id', 'id') ?>order('', 'is_private') ?>order(t('Project'), \Kanboard\Model\Project::TABLE.'.name') ?>
+ render('project/dropdown', array('project' => $project)) ?> + + + + + + user->hasProjectAccess('gantt', 'project', $project['id'])): ?> + url->link('', 'gantt', 'project', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Gantt chart')) ?> + + + url->link('', 'listing', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('List')) ?>  + url->link('', 'calendar', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?>  + + url->link($this->text->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?> + + + + + + + + + text->e($column['title']) ?> + +
+ + + diff --git a/app/Template/dashboard/show.php b/app/Template/dashboard/show.php new file mode 100644 index 00000000..bc4e2952 --- /dev/null +++ b/app/Template/dashboard/show.php @@ -0,0 +1,12 @@ +
+ + form->hidden('controller', array('controller' => 'search')) ?> + form->hidden('action', array('action' => 'index')) ?> + form->text('search', array(), array(), array('placeholder="'.t('Search').'"'), 'form-input-large') ?> + render('app/filters_helper') ?> + +
+ +render('dashboard/projects', array('paginator' => $project_paginator, 'user' => $user)) ?> +render('dashboard/tasks', array('paginator' => $task_paginator, 'user' => $user)) ?> +render('dashboard/subtasks', array('paginator' => $subtask_paginator, 'user' => $user)) ?> diff --git a/app/Template/dashboard/sidebar.php b/app/Template/dashboard/sidebar.php new file mode 100644 index 00000000..86cc20f8 --- /dev/null +++ b/app/Template/dashboard/sidebar.php @@ -0,0 +1,27 @@ + diff --git a/app/Template/dashboard/subtasks.php b/app/Template/dashboard/subtasks.php new file mode 100644 index 00000000..ee6caf02 --- /dev/null +++ b/app/Template/dashboard/subtasks.php @@ -0,0 +1,43 @@ + +isEmpty()): ?> +

+ + + + + + + + + + getCollection() as $subtask): ?> + + + + + + + + +
order('Id', 'tasks.id') ?>order(t('Project'), 'project_name') ?>order(t('Task'), 'task_name') ?>order(t('Subtask'), 'title') ?>
+ render('task/dropdown', array('task' => array('id' => $subtask['task_id'], 'project_id' => $subtask['project_id']))) ?> + + url->link($this->text->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> + + url->link($this->text->e($subtask['task_name']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?> + + subtask->toggleStatus($subtask, $subtask['project_id']) ?> + + + text->e($subtask['time_spent']).'h' ?> + + + + text->e($subtask['time_estimated']).'h' ?> + +
+ + + diff --git a/app/Template/dashboard/tasks.php b/app/Template/dashboard/tasks.php new file mode 100644 index 00000000..71b62572 --- /dev/null +++ b/app/Template/dashboard/tasks.php @@ -0,0 +1,49 @@ + +isEmpty()): ?> +

+ + + + + + + + + + + getCollection() as $task): ?> + + + + + + + + + +
order('Id', 'tasks.id') ?>order(t('Project'), 'project_name') ?>order(t('Task'), 'title') ?>order('Priority', 'tasks.priority') ?>order(t('Due date'), 'date_due') ?>
+ render('task/dropdown', array('task' => $task)) ?> + + url->link($this->text->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?> + + url->link($this->text->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + + = 0): ?> + Ptext->e($task['priority'])?> + + + + text->e($task['time_spent']).'h' ?> + + + + text->e($task['time_estimated']).'h' ?> + + + dt->date($task['date_due']) ?> +
+ + + diff --git a/app/Template/header.php b/app/Template/header.php index 3885e671..f47b270f 100644 --- a/app/Template/header.php +++ b/app/Template/header.php @@ -2,7 +2,7 @@