summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-09 20:04:27 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-09 20:04:27 -0500
commit7eadf7cfd80176ab9b74c9c6a55c28db0f43fa88 (patch)
treeb55b32bf9200f4ed045adfabaadb00d0ce20fc65 /app/Controller
parente89ba5e9e692f33427fedb05a095255f27480a6b (diff)
Start templates cleanup and reorganisation
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Action.php8
-rw-r--r--app/Controller/App.php2
-rw-r--r--app/Controller/Base.php4
-rw-r--r--app/Controller/Board.php64
-rw-r--r--app/Controller/Webhook.php2
5 files changed, 26 insertions, 54 deletions
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';