Start templates cleanup and reorganisation

This commit is contained in:
Frédéric Guillot
2014-11-09 20:04:27 -05:00
parent e89ba5e9e6
commit 7eadf7cfd8
28 changed files with 182 additions and 195 deletions

View File

@@ -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(),

View File

@@ -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),

View File

@@ -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,
)));

View File

@@ -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'),

View File

@@ -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';