From 7eadf7cfd80176ab9b74c9c6a55c28db0f43fa88 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 9 Nov 2014 20:04:27 -0500 Subject: Start templates cleanup and reorganisation --- app/Controller/Action.php | 8 +-- app/Controller/App.php | 2 +- app/Controller/Base.php | 4 +- app/Controller/Board.php | 64 +++++++--------------- app/Controller/Webhook.php | 2 +- app/Core/Request.php | 11 ++++ app/Model/GithubWebhook.php | 6 +-- app/Template/action/event.php | 25 +++++++++ app/Template/action/index.php | 64 ++++++++++++++++++++++ app/Template/action/params.php | 43 +++++++++++++++ app/Template/action/remove.php | 15 ++++++ app/Template/action_event.php | 22 -------- app/Template/action_index.php | 65 ----------------------- app/Template/action_params.php | 40 -------------- app/Template/action_remove.php | 14 ----- app/Template/app/forbidden.php | 5 ++ app/Template/app/index.php | 83 +++++++++++++++++++++++++++++ app/Template/app/notfound.php | 5 ++ app/Template/app_forbidden.php | 5 -- app/Template/app_index.php | 83 ----------------------------- app/Template/app_notfound.php | 5 -- app/Template/board/assignee.php | 21 ++++++++ app/Template/board/category.php | 22 ++++++++ app/Template/board/edit.php | 61 +++++++++++++++++++++ app/Template/board/filters.php | 35 ++++++++++++ app/Template/board/index.php | 21 ++++++++ app/Template/board/remove.php | 15 ++++++ app/Template/board/rename.php | 34 ++++++++++++ app/Template/board/show.php | 51 ++++++++++++++++++ app/Template/board/task.php | 115 ++++++++++++++++++++++++++++++++++++++++ app/Template/board_assignee.php | 24 --------- app/Template/board_category.php | 24 --------- app/Template/board_edit.php | 58 -------------------- app/Template/board_index.php | 50 ----------------- app/Template/board_public.php | 34 ------------ app/Template/board_remove.php | 15 ------ app/Template/board_show.php | 49 ----------------- app/Template/board_task.php | 109 ------------------------------------- app/Template/layout.php | 2 +- assets/js/app.js | 32 +++++------ assets/js/base.js | 2 +- assets/js/board.js | 30 +++++------ 42 files changed, 681 insertions(+), 694 deletions(-) create mode 100644 app/Template/action/event.php create mode 100644 app/Template/action/index.php create mode 100644 app/Template/action/params.php create mode 100644 app/Template/action/remove.php delete mode 100644 app/Template/action_event.php delete mode 100644 app/Template/action_index.php delete mode 100644 app/Template/action_params.php delete mode 100644 app/Template/action_remove.php create mode 100644 app/Template/app/forbidden.php create mode 100644 app/Template/app/index.php create mode 100644 app/Template/app/notfound.php delete mode 100644 app/Template/app_forbidden.php delete mode 100644 app/Template/app_index.php delete mode 100644 app/Template/app_notfound.php create mode 100644 app/Template/board/assignee.php create mode 100644 app/Template/board/category.php create mode 100644 app/Template/board/edit.php create mode 100644 app/Template/board/filters.php create mode 100644 app/Template/board/index.php create mode 100644 app/Template/board/remove.php create mode 100644 app/Template/board/rename.php create mode 100644 app/Template/board/show.php create mode 100644 app/Template/board/task.php delete mode 100644 app/Template/board_assignee.php delete mode 100644 app/Template/board_category.php delete mode 100644 app/Template/board_edit.php delete mode 100644 app/Template/board_index.php delete mode 100644 app/Template/board_public.php delete mode 100644 app/Template/board_remove.php delete mode 100644 app/Template/board_show.php delete mode 100644 app/Template/board_task.php diff --git a/app/Controller/Action.php b/app/Controller/Action.php index bf72f36f..22358cb5 100644 --- a/app/Controller/Action.php +++ b/app/Controller/Action.php @@ -19,7 +19,7 @@ class Action extends Base { $project = $this->getProjectManagement(); - $this->response->html($this->projectLayout('action_index', array( + $this->response->html($this->projectLayout('action/index', array( 'values' => array('project_id' => $project['id']), 'project' => $project, 'actions' => $this->action->getAllByProject($project['id']), @@ -49,7 +49,7 @@ class Action extends Base $this->response->redirect('?controller=action&action=index&project_id='.$project['id']); } - $this->response->html($this->projectLayout('action_event', array( + $this->response->html($this->projectLayout('action/event', array( 'values' => $values, 'project' => $project, 'events' => $this->action->getCompatibleEvents($values['action_name']), @@ -81,7 +81,7 @@ class Action extends Base $projects_list = $this->project->getList(false); unset($projects_list[$project['id']]); - $this->response->html($this->projectLayout('action_params', array( + $this->response->html($this->projectLayout('action/params', array( 'values' => $values, 'action_params' => $action_params, 'columns_list' => $this->board->getColumnsList($project['id']), @@ -137,7 +137,7 @@ class Action extends Base { $project = $this->getProjectManagement(); - $this->response->html($this->projectLayout('action_remove', array( + $this->response->html($this->projectLayout('action/remove', array( 'action' => $this->action->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->action->getAvailableEvents(), 'available_actions' => $this->action->getAvailableActions(), diff --git a/app/Controller/App.php b/app/Controller/App.php index 7fa97d4f..9f8ded19 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -23,7 +23,7 @@ class App extends Base $projects = $this->projectPermission->getMemberProjects($user_id); $project_ids = array_keys($projects); - $this->response->html($this->template->layout('app_index', array( + $this->response->html($this->template->layout('app/index', array( 'board_selector' => $this->projectPermission->getAllowedProjects($user_id), 'events' => $this->projectActivity->getProjects($project_ids, 10), 'tasks' => $this->taskFinder->getAllTasksByUser($user_id), diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 7eb75b07..2c8fb221 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -174,7 +174,7 @@ abstract class Base */ public function notfound($no_layout = false) { - $this->response->html($this->template->layout('app_notfound', array( + $this->response->html($this->template->layout('app/notfound', array( 'title' => t('Page not found'), 'no_layout' => $no_layout, ))); @@ -188,7 +188,7 @@ abstract class Base */ public function forbidden($no_layout = false) { - $this->response->html($this->template->layout('app_forbidden', array( + $this->response->html($this->template->layout('app/forbidden', array( 'title' => t('Access Forbidden'), 'no_layout' => $no_layout, ))); diff --git a/app/Controller/Board.php b/app/Controller/Board.php index a2d6628f..f5bb4d80 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -43,24 +43,11 @@ class Board extends Base $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $params = array( - 'errors' => array(), + $this->response->html($this->template->load('board/assignee', array( 'values' => $task, 'users_list' => $this->projectPermission->getMemberList($project['id']), - 'current_project_id' => $project['id'], - 'current_project_name' => $project['name'], - ); - - if ($this->request->isAjax()) { - - $this->response->html($this->template->load('board_assignee', $params)); - } - else { - - $this->response->html($this->template->layout('board_assignee', $params + array( - 'title' => t('Change assignee').' - '.$task['title'], - ))); - } + 'project' => $project, + ))); } /** @@ -95,24 +82,11 @@ class Board extends Base $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $params = array( - 'errors' => array(), + $this->response->html($this->template->load('board/category', array( 'values' => $task, 'categories_list' => $this->category->getList($project['id']), - 'current_project_id' => $project['id'], - 'current_project_name' => $project['name'], - ); - - if ($this->request->isAjax()) { - - $this->response->html($this->template->load('board_category', $params)); - } - else { - - $this->response->html($this->template->layout('board_category', $params + array( - 'title' => t('Change category').' - '.$task['title'], - ))); - } + 'project' => $project, + ))); } /** @@ -154,7 +128,7 @@ class Board extends Base } // Display the board with a specific layout - $this->response->html($this->template->layout('board_public', array( + $this->response->html($this->template->layout('board/public', array( 'project' => $project, 'columns' => $this->board->get($project['id']), 'categories' => $this->category->getList($project['id'], false), @@ -210,12 +184,10 @@ class Board extends Base $this->user->storeLastSeenProjectId($project['id']); - $this->response->html($this->template->layout('board_index', array( + $this->response->html($this->template->layout('board/index', array( 'users' => $this->projectPermission->getMemberList($project['id'], true, true), - 'filters' => array('user_id' => UserModel::EVERYBODY_ID), 'projects' => $projects, - 'current_project_id' => $project['id'], - 'current_project_name' => $project['name'], + 'project' => $project, 'board' => $this->board->get($project['id']), 'categories' => $this->category->getList($project['id'], true, true), 'title' => $project['name'], @@ -241,7 +213,7 @@ class Board extends Base $values['task_limit['.$column['id'].']'] = $column['task_limit'] ?: null; } - $this->response->html($this->projectLayout('board_edit', array( + $this->response->html($this->projectLayout('board/edit', array( 'errors' => array(), 'values' => $values + array('project_id' => $project['id']), 'columns' => $columns, @@ -281,7 +253,7 @@ class Board extends Base } } - $this->response->html($this->projectLayout('board_edit', array( + $this->response->html($this->projectLayout('board/edit', array( 'errors' => $errors, 'values' => $values + array('project_id' => $project['id']), 'columns' => $columns, @@ -319,7 +291,7 @@ class Board extends Base } } - $this->response->html($this->projectLayout('board_edit', array( + $this->response->html($this->projectLayout('board/edit', array( 'errors' => $errors, 'values' => $values + $data, 'columns' => $columns, @@ -351,7 +323,7 @@ class Board extends Base $this->response->redirect('?controller=board&action=edit&project_id='.$project['id']); } - $this->response->html($this->projectLayout('board_remove', array( + $this->response->html($this->projectLayout('board/remove', array( 'column' => $this->board->getColumn($this->request->getIntegerParam('column_id')), 'project' => $project, 'title' => t('Remove a column from a board') @@ -373,13 +345,13 @@ class Board extends Base $this->response->status(401); } - $values = $this->request->getValues(); + $values = $this->request->getJson(); if ($this->task->movePosition($project_id, $values['task_id'], $values['column_id'], $values['position'])) { $this->response->html( - $this->template->load('board_show', array( - 'current_project_id' => $project_id, + $this->template->load('board/show', array( + 'project' => $this->project->getById($project_id), 'board' => $this->board->get($project_id), 'categories' => $this->category->getList($project_id, false), 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), @@ -416,8 +388,8 @@ class Board extends Base if ($this->project->isModifiedSince($project_id, $timestamp)) { $this->response->html( - $this->template->load('board_show', array( - 'current_project_id' => $project_id, + $this->template->load('board/show', array( + 'project' => $this->project->getById($project_id), 'board' => $this->board->get($project_id), 'categories' => $this->category->getList($project_id, false), 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), diff --git a/app/Controller/Webhook.php b/app/Controller/Webhook.php index fa9c5834..a0bf369a 100644 --- a/app/Controller/Webhook.php +++ b/app/Controller/Webhook.php @@ -57,7 +57,7 @@ class Webhook extends Base $result = $this->githubWebhook->parsePayload( $this->request->getHeader('X-Github-Event'), - $this->request->getBody() + $this->request->getJson() ); echo $result ? 'PARSED' : 'IGNORED'; diff --git a/app/Core/Request.php b/app/Core/Request.php index a4c426f0..1b643208 100644 --- a/app/Core/Request.php +++ b/app/Core/Request.php @@ -75,6 +75,17 @@ class Request return file_get_contents('php://input'); } + /** + * Get the Json request body + * + * @access public + * @return array + */ + public function getJson() + { + return json_decode($this->getBody(), true); + } + /** * Get the content of an uploaded file * diff --git a/app/Model/GithubWebhook.php b/app/Model/GithubWebhook.php index 58c2fa54..9c8bd366 100644 --- a/app/Model/GithubWebhook.php +++ b/app/Model/GithubWebhook.php @@ -47,13 +47,11 @@ class GithubWebhook extends Base * * @access public * @param string $type Github event type - * @param string $payload Raw Github event (JSON) + * @param array $payload Github event * @return boolean */ - public function parsePayload($type, $payload) + public function parsePayload($type, array $payload) { - $payload = json_decode($payload, true); - switch ($type) { case 'push': return $this->parsePushEvent($payload); diff --git a/app/Template/action/event.php b/app/Template/action/event.php new file mode 100644 index 00000000..565e900c --- /dev/null +++ b/app/Template/action/event.php @@ -0,0 +1,25 @@ + + +

+
+ + + + + + + +
+ +
+ +
+ +
+ + + $project['id'])) ?> +
+
\ No newline at end of file diff --git a/app/Template/action/index.php b/app/Template/action/index.php new file mode 100644 index 00000000..85839098 --- /dev/null +++ b/app/Template/action/index.php @@ -0,0 +1,64 @@ + + + + +

+ + + + + + + + + + + + + + + + +
+
    + +
  • + = + + + + + + + + + + + + + + + +
  • + +
+
+ $project['id'], 'action_id' => $action['id'])) ?> +
+ + + +

+
+ + + + +
+ +
+ +
+
\ No newline at end of file diff --git a/app/Template/action/params.php b/app/Template/action/params.php new file mode 100644 index 00000000..f221d92e --- /dev/null +++ b/app/Template/action/params.php @@ -0,0 +1,43 @@ + + +

+
+ + + + + + + + $param_desc): ?> + + + +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + +
+ + + $project['id'])) ?> +
+
\ No newline at end of file diff --git a/app/Template/action/remove.php b/app/Template/action/remove.php new file mode 100644 index 00000000..131c2b54 --- /dev/null +++ b/app/Template/action/remove.php @@ -0,0 +1,15 @@ + + +
+

+ +

+ +
+ $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?> + + $project['id'])) ?> +
+
\ No newline at end of file diff --git a/app/Template/action_event.php b/app/Template/action_event.php deleted file mode 100644 index eee41780..00000000 --- a/app/Template/action_event.php +++ /dev/null @@ -1,22 +0,0 @@ - - -

-
- - - - - -
- -
- -
- -
- - -
-
\ No newline at end of file diff --git a/app/Template/action_index.php b/app/Template/action_index.php deleted file mode 100644 index 30874591..00000000 --- a/app/Template/action_index.php +++ /dev/null @@ -1,65 +0,0 @@ - - - - -

- - - - - - - - - - - - - - - - - -
-
    - -
  • - = - - - - - - - - - - - - - - - -
  • - -
-
- -
- - - -

-
- - - - -
- -
- -
-
\ No newline at end of file diff --git a/app/Template/action_params.php b/app/Template/action_params.php deleted file mode 100644 index f647149b..00000000 --- a/app/Template/action_params.php +++ /dev/null @@ -1,40 +0,0 @@ - - -

-
- - - - - - $param_desc): ?> - - - -
- - -
- - -
- - -
- - -
- - - - - - - -
- - -
-
\ No newline at end of file diff --git a/app/Template/action_remove.php b/app/Template/action_remove.php deleted file mode 100644 index 668067da..00000000 --- a/app/Template/action_remove.php +++ /dev/null @@ -1,14 +0,0 @@ - - -
-

- -

- -
- $project['id'], 'action_id' => $action['id']), true, 'btn btn-red') ?> - $project['id'])) ?> -
-
\ No newline at end of file diff --git a/app/Template/app/forbidden.php b/app/Template/app/forbidden.php new file mode 100644 index 00000000..96e76115 --- /dev/null +++ b/app/Template/app/forbidden.php @@ -0,0 +1,5 @@ +
+

+ +

+
\ No newline at end of file diff --git a/app/Template/app/index.php b/app/Template/app/index.php new file mode 100644 index 00000000..1aa5819a --- /dev/null +++ b/app/Template/app/index.php @@ -0,0 +1,83 @@ +
+ +
+
+

+ +

+ + + + + + + + + + + + + + +
 
+ $project['id']), false, 'dashboard-table-link') ?> + + + ', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?>  + + $project['id'])) ?> + + + + + +
+ + +

+ +

+ + + + + + + + + + + + + + + + +
 
+ $task['id'])) ?> + + $task['project_id'])) ?> + + $task['id'])) ?> + + +
+ +
+
+

+ $events)) ?> +
+
\ No newline at end of file diff --git a/app/Template/app/notfound.php b/app/Template/app/notfound.php new file mode 100644 index 00000000..686f1fa0 --- /dev/null +++ b/app/Template/app/notfound.php @@ -0,0 +1,5 @@ +
+

+ +

+
\ No newline at end of file diff --git a/app/Template/app_forbidden.php b/app/Template/app_forbidden.php deleted file mode 100644 index 96e76115..00000000 --- a/app/Template/app_forbidden.php +++ /dev/null @@ -1,5 +0,0 @@ -
-

- -

-
\ No newline at end of file diff --git a/app/Template/app_index.php b/app/Template/app_index.php deleted file mode 100644 index 1aa5819a..00000000 --- a/app/Template/app_index.php +++ /dev/null @@ -1,83 +0,0 @@ -
- -
-
-

- -

- - - - - - - - - - - - - - -
 
- $project['id']), false, 'dashboard-table-link') ?> - - - ', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?>  - - $project['id'])) ?> - - - - - -
- - -

- -

- - - - - - - - - - - - - - - - -
 
- $task['id'])) ?> - - $task['project_id'])) ?> - - $task['id'])) ?> - - -
- -
-
-

- $events)) ?> -
-
\ No newline at end of file diff --git a/app/Template/app_notfound.php b/app/Template/app_notfound.php deleted file mode 100644 index 686f1fa0..00000000 --- a/app/Template/app_notfound.php +++ /dev/null @@ -1,5 +0,0 @@ -
-

- -

-
\ No newline at end of file diff --git a/app/Template/board/assignee.php b/app/Template/board/assignee.php new file mode 100644 index 00000000..434daa51 --- /dev/null +++ b/app/Template/board/assignee.php @@ -0,0 +1,21 @@ +
+
+

+
+ + + + + + + +
+ +
+ + + $project['id'])) ?> +
+
+
+
\ No newline at end of file diff --git a/app/Template/board/category.php b/app/Template/board/category.php new file mode 100644 index 00000000..88d8e71c --- /dev/null +++ b/app/Template/board/category.php @@ -0,0 +1,22 @@ +
+
+

+
+ + + + + + + +
+ +
+ + + $project['id'])) ?> +
+
+
+ +
\ No newline at end of file diff --git a/app/Template/board/edit.php b/app/Template/board/edit.php new file mode 100644 index 00000000..2c3236e2 --- /dev/null +++ b/app/Template/board/edit.php @@ -0,0 +1,61 @@ + +
+ +

+
+ + + + + + + + + + + + + + + + + +
+
    + +
  • + $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?> +
  • + + +
  • + $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?> +
  • + +
  • + $project['id'], 'column_id' => $column['id'])) ?> +
  • +
+
+ +
+ +
+
+ +

+
+ + + + + + + + +
+ +
+
\ No newline at end of file diff --git a/app/Template/board/filters.php b/app/Template/board/filters.php new file mode 100644 index 00000000..21e51d98 --- /dev/null +++ b/app/Template/board/filters.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/app/Template/board/index.php b/app/Template/board/index.php new file mode 100644 index 00000000..21040373 --- /dev/null +++ b/app/Template/board/index.php @@ -0,0 +1,21 @@ +
+ + $categories, + 'users' => $users, + 'project' => $project, + )) ?> + + +

+ + $project, + 'board' => $board, + 'categories' => $categories, + 'board_private_refresh_interval' => $board_private_refresh_interval, + 'board_highlight_period' => $board_highlight_period, + )) ?> + + +
diff --git a/app/Template/board/remove.php b/app/Template/board/remove.php new file mode 100644 index 00000000..4529063b --- /dev/null +++ b/app/Template/board/remove.php @@ -0,0 +1,15 @@ + + +
+

+ + +

+ +
+ $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> + $project['id'])) ?> +
+
\ No newline at end of file diff --git a/app/Template/board/rename.php b/app/Template/board/rename.php new file mode 100644 index 00000000..6514b0e5 --- /dev/null +++ b/app/Template/board/rename.php @@ -0,0 +1,34 @@ +
+ + +

+ + + + + + + + + + + + + +
+ + + () + +
+ +
+ + $task, 'categories' => $categories, 'not_editable' => true, 'project' => $project)) ?> + +
+ +
+ + +
\ No newline at end of file diff --git a/app/Template/board/show.php b/app/Template/board/show.php new file mode 100644 index 00000000..66e8b46d --- /dev/null +++ b/app/Template/board/show.php @@ -0,0 +1,51 @@ + + + + + + + + + + + + +
+
+ $column['project_id'], 'column_id' => $column['id']), false, '', t('Add a new task')) ?> +
+ + + + (/) + + + + () + + +
+ +
+ + $task, 'categories' => $categories)) ?> + +
+ +
diff --git a/app/Template/board/task.php b/app/Template/board/task.php new file mode 100644 index 00000000..02ae46c1 --- /dev/null +++ b/app/Template/board/task.php @@ -0,0 +1,115 @@ + + + $task['id'], 'token' => $project['token'])) ?> + + + + () + + + +  -  + + + + + + + + + + + + + +
+ $task['id'], 'token' => $project['token'])) ?> +
+ + + + $task['id']), false, 'task-edit-popover', t('Edit this task')) ?> + + + + () + + + +  -  + + + $task['id']), + false, + 'assignee-popover', + t('Change assignee') + ) ?> + + + + + + +
+ $task['id']), false, '', t('View this task')) ?> +
+ + + + + +
+ + $task['id']), + false, + 'category-popover', + t('Change category') + ) ?> + +
+ + + + + + diff --git a/app/Template/board_assignee.php b/app/Template/board_assignee.php deleted file mode 100644 index 41ede32b..00000000 --- a/app/Template/board_assignee.php +++ /dev/null @@ -1,24 +0,0 @@ -
- - - -
-

-
- - - - - -
- -
- - -
-
-
- -
\ No newline at end of file diff --git a/app/Template/board_category.php b/app/Template/board_category.php deleted file mode 100644 index 36126a1d..00000000 --- a/app/Template/board_category.php +++ /dev/null @@ -1,24 +0,0 @@ -
- - - -
-

-
- - - - - -
- -
- - -
-
-
- -
\ No newline at end of file diff --git a/app/Template/board_edit.php b/app/Template/board_edit.php deleted file mode 100644 index cfaebc50..00000000 --- a/app/Template/board_edit.php +++ /dev/null @@ -1,58 +0,0 @@ - -
- -

-
- - - - - - - - - - - - - - - - - -
-
    - -
  • - $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?> -
  • - - -
  • - $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?> -
  • - -
  • - $project['id'], 'column_id' => $column['id'])) ?> -
  • -
-
- -
- -
-
- -

-
- - - - - -
- -
-
\ No newline at end of file diff --git a/app/Template/board_index.php b/app/Template/board_index.php deleted file mode 100644 index e478680f..00000000 --- a/app/Template/board_index.php +++ /dev/null @@ -1,50 +0,0 @@ -
- - - -

- - $current_project_id, - 'board' => $board, - 'categories' => $categories, - 'board_private_refresh_interval' => $board_private_refresh_interval, - 'board_highlight_period' => $board_highlight_period, - )) ?> - - -
diff --git a/app/Template/board_public.php b/app/Template/board_public.php deleted file mode 100644 index 85c90cfa..00000000 --- a/app/Template/board_public.php +++ /dev/null @@ -1,34 +0,0 @@ -
- - -

- - - - - - - - - - - - - -
- - - () - -
- -
- - $task, 'categories' => $categories, 'not_editable' => true, 'project' => $project)) ?> - -
- -
- - -
\ No newline at end of file diff --git a/app/Template/board_remove.php b/app/Template/board_remove.php deleted file mode 100644 index 4529063b..00000000 --- a/app/Template/board_remove.php +++ /dev/null @@ -1,15 +0,0 @@ - - -
-

- - -

- -
- $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?> - $project['id'])) ?> -
-
\ No newline at end of file diff --git a/app/Template/board_show.php b/app/Template/board_show.php deleted file mode 100644 index 4865ce5c..00000000 --- a/app/Template/board_show.php +++ /dev/null @@ -1,49 +0,0 @@ -> - - - - - - - - - - - -
-
- $column['project_id'], 'column_id' => $column['id']), false, '', t('Add a new task')) ?> -
- - - - (/) - - - - () - - -
- -
- - $task, 'categories' => $categories)) ?> - -
- -
diff --git a/app/Template/board_task.php b/app/Template/board_task.php deleted file mode 100644 index ca854f37..00000000 --- a/app/Template/board_task.php +++ /dev/null @@ -1,109 +0,0 @@ - - - # - - - - () - - - -  -  - - - - - - - - - - - - - -
- - - -
- - - - # - - - - () - - - -  -  - - - - - - - - - - - - - - - -
- -
- - - - - -
- - - - - -
- - - - - - diff --git a/app/Template/layout.php b/app/Template/layout.php index 58761414..31a4c407 100644 --- a/app/Template/layout.php +++ b/app/Template/layout.php @@ -34,7 +34,7 @@
  • - $board_name): ?> diff --git a/assets/js/app.js b/assets/js/app.js index 2dbcdc42..55bc4039 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -97,7 +97,7 @@ var Kanboard = (function() { }); $("#board-selector").change(function() { - window.location = "?controller=board&action=show&project_id=" + $(this).val(); + window.location = $(this).attr("data-board-url").replace(/%d/g, $(this).val()); }); } }; @@ -140,9 +140,9 @@ Kanboard.Board = (function() { $(".task-description-popover").click(Kanboard.Popover); // Redirect to the task details page - $("[data-task-id]").each(function() { + $("[data-task-url]").each(function() { $(this).click(function() { - window.location = "?controller=task&action=show&task_id=" + $(this).attr("data-task-id"); + window.location = $(this).attr("data-task-url"); }); }); @@ -157,28 +157,26 @@ Kanboard.Board = (function() { // Stop events function board_unload_events() { - $("[data-task-id]").off(); + $("[data-task-url]").off(); clearInterval(checkInterval); } // Save and refresh the board function board_save(taskId, columnId, position) { - var boardSelector = $("#board"); - var projectId = boardSelector.attr("data-project-id"); - board_unload_events(); $.ajax({ cache: false, - url: "?controller=board&action=save&project_id=" + projectId, - data: { + url: $("#board").attr("data-save-url"), + contentType: "application/json", + type: "POST", + processData: false, + data: JSON.stringify({ "task_id": taskId, "column_id": columnId, "position": position, - "csrf_token": boardSelector.attr("data-csrf-token"), - }, - type: "POST", + }), success: function(data) { $("#board").remove(); $("#main").append(data); @@ -191,17 +189,13 @@ Kanboard.Board = (function() { // Check if a board have been changed by someone else function board_check() { - var boardSelector = $("#board"); - var projectId = boardSelector.attr("data-project-id"); - var timestamp = boardSelector.attr("data-time"); - - if (Kanboard.IsVisible() && projectId != undefined && timestamp != undefined) { + if (Kanboard.IsVisible()) { $.ajax({ cache: false, - url: "?controller=board&action=check&project_id=" + projectId + "×tamp=" + timestamp, + url: $("#board").attr("data-check-url"), statusCode: { 200: function(data) { - boardSelector.remove(); + $("#board").remove(); $("#main").append(data); board_unload_events(); board_load_events(); diff --git a/assets/js/base.js b/assets/js/base.js index 1e5ff967..0a17696e 100644 --- a/assets/js/base.js +++ b/assets/js/base.js @@ -82,7 +82,7 @@ var Kanboard = (function() { }); $("#board-selector").change(function() { - window.location = "?controller=board&action=show&project_id=" + $(this).val(); + window.location = $(this).attr("data-board-url").replace(/%d/g, $(this).val()); }); } }; diff --git a/assets/js/board.js b/assets/js/board.js index 1d890a33..09dbd069 100644 --- a/assets/js/board.js +++ b/assets/js/board.js @@ -36,9 +36,9 @@ Kanboard.Board = (function() { $(".task-description-popover").click(Kanboard.Popover); // Redirect to the task details page - $("[data-task-id]").each(function() { + $("[data-task-url]").each(function() { $(this).click(function() { - window.location = "?controller=task&action=show&task_id=" + $(this).attr("data-task-id"); + window.location = $(this).attr("data-task-url"); }); }); @@ -53,28 +53,26 @@ Kanboard.Board = (function() { // Stop events function board_unload_events() { - $("[data-task-id]").off(); + $("[data-task-url]").off(); clearInterval(checkInterval); } // Save and refresh the board function board_save(taskId, columnId, position) { - var boardSelector = $("#board"); - var projectId = boardSelector.attr("data-project-id"); - board_unload_events(); $.ajax({ cache: false, - url: "?controller=board&action=save&project_id=" + projectId, - data: { + url: $("#board").attr("data-save-url"), + contentType: "application/json", + type: "POST", + processData: false, + data: JSON.stringify({ "task_id": taskId, "column_id": columnId, "position": position, - "csrf_token": boardSelector.attr("data-csrf-token"), - }, - type: "POST", + }), success: function(data) { $("#board").remove(); $("#main").append(data); @@ -87,17 +85,13 @@ Kanboard.Board = (function() { // Check if a board have been changed by someone else function board_check() { - var boardSelector = $("#board"); - var projectId = boardSelector.attr("data-project-id"); - var timestamp = boardSelector.attr("data-time"); - - if (Kanboard.IsVisible() && projectId != undefined && timestamp != undefined) { + if (Kanboard.IsVisible()) { $.ajax({ cache: false, - url: "?controller=board&action=check&project_id=" + projectId + "×tamp=" + timestamp, + url: $("#board").attr("data-check-url"), statusCode: { 200: function(data) { - boardSelector.remove(); + $("#board").remove(); $("#main").append(data); board_unload_events(); board_load_events(); -- cgit v1.2.3