Template helpers refactoring
This commit is contained in:
@@ -21,7 +21,7 @@ class Analytic extends Base
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
|
||||
$params['analytic_content_for_layout'] = $this->template->load($template, $params);
|
||||
$params['analytic_content_for_layout'] = $this->template->render($template, $params);
|
||||
|
||||
return $this->template->layout('analytic/layout', $params);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Controller;
|
||||
|
||||
use Model\SubTask as SubTaskModel;
|
||||
use Helper;
|
||||
|
||||
/**
|
||||
* Application controller
|
||||
@@ -192,7 +191,7 @@ class App extends Base
|
||||
$this->response->html('<p>'.t('Nothing to preview...').'</p>');
|
||||
}
|
||||
else {
|
||||
$this->response->html(Helper\markdown($payload['text']));
|
||||
$this->response->html($this->template->markdown($payload['text']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ use Symfony\Component\EventDispatcher\Event;
|
||||
* @package controller
|
||||
* @author Frederic Guillot
|
||||
*
|
||||
* @property \Core\Session $session
|
||||
* @property \Core\Template $template
|
||||
* @property \Model\Acl $acl
|
||||
* @property \Model\Authentication $authentication
|
||||
* @property \Model\Action $action
|
||||
@@ -69,22 +71,6 @@ abstract class Base
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* Template instance
|
||||
*
|
||||
* @accesss protected
|
||||
* @var \Core\Template
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* Session instance
|
||||
*
|
||||
* @accesss public
|
||||
* @var \Core\Session
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* Container instance
|
||||
*
|
||||
@@ -104,8 +90,6 @@ abstract class Base
|
||||
$this->container = $container;
|
||||
$this->request = new Request;
|
||||
$this->response = new Response;
|
||||
$this->session = new Session;
|
||||
$this->template = new Template;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +249,7 @@ abstract class Base
|
||||
$params['hide_remove_menu'] = true;
|
||||
}
|
||||
|
||||
$content = $this->template->load($template, $params);
|
||||
$content = $this->template->render($template, $params);
|
||||
$params['task_content_for_layout'] = $content;
|
||||
$params['title'] = $params['task']['project_name'].' > '.$params['task']['title'];
|
||||
$params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
|
||||
@@ -283,7 +267,7 @@ abstract class Base
|
||||
*/
|
||||
protected function projectLayout($template, array $params)
|
||||
{
|
||||
$content = $this->template->load($template, $params);
|
||||
$content = $this->template->render($template, $params);
|
||||
$params['project_content_for_layout'] = $content;
|
||||
$params['title'] = $params['project']['name'] === $params['title'] ? $params['title'] : $params['project']['name'].' > '.$params['title'];
|
||||
$params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
|
||||
|
||||
@@ -39,7 +39,7 @@ class Board extends Base
|
||||
$task = $this->getTask();
|
||||
$project = $this->project->getById($task['project_id']);
|
||||
|
||||
$this->response->html($this->template->load('board/assignee', array(
|
||||
$this->response->html($this->template->render('board/assignee', array(
|
||||
'values' => $task,
|
||||
'users_list' => $this->projectPermission->getMemberList($project['id']),
|
||||
'project' => $project,
|
||||
@@ -78,7 +78,7 @@ class Board extends Base
|
||||
$task = $this->getTask();
|
||||
$project = $this->project->getById($task['project_id']);
|
||||
|
||||
$this->response->html($this->template->load('board/category', array(
|
||||
$this->response->html($this->template->render('board/category', array(
|
||||
'values' => $task,
|
||||
'categories_list' => $this->category->getList($project['id']),
|
||||
'project' => $project,
|
||||
@@ -360,7 +360,7 @@ class Board extends Base
|
||||
}
|
||||
|
||||
$this->response->html(
|
||||
$this->template->load('board/show', array(
|
||||
$this->template->render('board/show', array(
|
||||
'project' => $this->project->getById($project_id),
|
||||
'swimlanes' => $this->board->getBoard($project_id),
|
||||
'categories' => $this->category->getList($project_id, false),
|
||||
@@ -394,7 +394,7 @@ class Board extends Base
|
||||
}
|
||||
|
||||
$this->response->html(
|
||||
$this->template->load('board/show', array(
|
||||
$this->template->render('board/show', array(
|
||||
'project' => $this->project->getById($project_id),
|
||||
'swimlanes' => $this->board->getBoard($project_id),
|
||||
'categories' => $this->category->getList($project_id, false),
|
||||
@@ -412,7 +412,7 @@ class Board extends Base
|
||||
public function subtasks()
|
||||
{
|
||||
$task = $this->getTask();
|
||||
$this->response->html($this->template->load('board/subtasks', array(
|
||||
$this->response->html($this->template->render('board/subtasks', array(
|
||||
'subtasks' => $this->subTask->getAll($task['id'])
|
||||
)));
|
||||
}
|
||||
@@ -427,7 +427,7 @@ class Board extends Base
|
||||
$task = $this->getTask();
|
||||
$this->subTask->toggleStatus($this->request->getIntegerParam('subtask_id'));
|
||||
|
||||
$this->response->html($this->template->load('board/subtasks', array(
|
||||
$this->response->html($this->template->render('board/subtasks', array(
|
||||
'subtasks' => $this->subTask->getAll($task['id'])
|
||||
)));
|
||||
}
|
||||
@@ -441,7 +441,7 @@ class Board extends Base
|
||||
{
|
||||
$task = $this->getTask();
|
||||
|
||||
$this->response->html($this->template->load('board/files', array(
|
||||
$this->response->html($this->template->render('board/files', array(
|
||||
'files' => $this->file->getAll($task['id'])
|
||||
)));
|
||||
}
|
||||
@@ -455,7 +455,7 @@ class Board extends Base
|
||||
{
|
||||
$task = $this->getTask();
|
||||
|
||||
$this->response->html($this->template->load('board/comments', array(
|
||||
$this->response->html($this->template->render('board/comments', array(
|
||||
'comments' => $this->comment->getAll($task['id'])
|
||||
)));
|
||||
}
|
||||
@@ -469,7 +469,7 @@ class Board extends Base
|
||||
{
|
||||
$task = $this->getTask();
|
||||
|
||||
$this->response->html($this->template->load('board/description', array(
|
||||
$this->response->html($this->template->render('board/description', array(
|
||||
'task' => $task
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class Config extends Base
|
||||
$params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
|
||||
$params['values'] = $this->config->getAll();
|
||||
$params['errors'] = array();
|
||||
$params['config_content_for_layout'] = $this->template->load($template, $params);
|
||||
$params['config_content_for_layout'] = $this->template->render($template, $params);
|
||||
|
||||
return $this->template->layout('config/layout', $params);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class File extends Base
|
||||
$file = $this->file->getById($this->request->getIntegerParam('file_id'));
|
||||
|
||||
if ($file['task_id'] == $task['id']) {
|
||||
$this->response->html($this->template->load('file/open', array(
|
||||
$this->response->html($this->template->render('file/open', array(
|
||||
'file' => $file
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ class Project extends Base
|
||||
$this->forbidden(true);
|
||||
}
|
||||
|
||||
$this->response->xml($this->template->load('project/feed', array(
|
||||
$this->response->xml($this->template->render('project/feed', array(
|
||||
'events' => $this->projectActivity->getProject($project['id']),
|
||||
'project' => $project,
|
||||
)));
|
||||
|
||||
@@ -89,7 +89,7 @@ class Task extends Base
|
||||
public function create(array $values = array(), array $errors = array())
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$method = $this->request->isAjax() ? 'load' : 'layout';
|
||||
$method = $this->request->isAjax() ? 'render' : 'layout';
|
||||
|
||||
if (empty($values)) {
|
||||
|
||||
@@ -179,7 +179,7 @@ class Task extends Base
|
||||
);
|
||||
|
||||
if ($ajax) {
|
||||
$this->response->html($this->template->load('task/edit', $params));
|
||||
$this->response->html($this->template->render('task/edit', $params));
|
||||
}
|
||||
else {
|
||||
$this->response->html($this->taskLayout('task/edit', $params));
|
||||
@@ -410,7 +410,7 @@ class Task extends Base
|
||||
);
|
||||
|
||||
if ($ajax) {
|
||||
$this->response->html($this->template->load('task/edit_description', $params));
|
||||
$this->response->html($this->template->render('task/edit_description', $params));
|
||||
}
|
||||
else {
|
||||
$this->response->html($this->taskLayout('task/edit_description', $params));
|
||||
|
||||
@@ -76,7 +76,7 @@ class User extends Base
|
||||
*/
|
||||
private function layout($template, array $params)
|
||||
{
|
||||
$content = $this->template->load($template, $params);
|
||||
$content = $this->template->render($template, $params);
|
||||
$params['user_content_for_layout'] = $content;
|
||||
$params['board_selector'] = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user