Remove method Category::getBoardCategories()

This commit is contained in:
Frederic Guillot
2015-07-01 20:55:21 -04:00
parent 471e46e702
commit 747b9434d3
11 changed files with 7 additions and 65 deletions

View File

@@ -26,14 +26,10 @@ class Board extends Base
$this->forbidden(true); $this->forbidden(true);
} }
list($categories_listing, $categories_description) = $this->category->getBoardCategories($project['id']);
// Display the board with a specific layout // 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, 'project' => $project,
'swimlanes' => $this->board->getBoard($project['id']), 'swimlanes' => $this->board->getBoard($project['id']),
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'title' => $project['name'], 'title' => $project['name'],
'description' => $project['description'], 'description' => $project['description'],
'no_layout' => true, 'no_layout' => true,
@@ -58,15 +54,12 @@ class Board extends Base
$board_selector = $projects; $board_selector = $projects;
unset($board_selector[$project['id']]); unset($board_selector[$project['id']]);
list($categories_listing, $categories_description) = $this->category->getBoardCategories($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), 'users' => $this->projectPermission->getMemberList($project['id'], true, true),
'projects' => $projects, 'projects' => $projects,
'project' => $project, 'project' => $project,
'swimlanes' => $this->board->getBoard($project['id']), 'swimlanes' => $this->board->getBoard($project['id']),
'categories_listing' => $categories_listing, 'categories_listing' => $this->category->getList($project['id'], true, true),
'categories_description' => $categories_description,
'title' => $project['name'], 'title' => $project['name'],
'description' => $project['description'], 'description' => $project['description'],
'board_selector' => $board_selector, 'board_selector' => $board_selector,
@@ -106,14 +99,10 @@ class Board extends Base
return $this->response->status(400); return $this->response->status(400);
} }
list($categories_listing, $categories_description) = $this->category->getBoardCategories($project_id);
$this->response->html( $this->response->html(
$this->template->render('board/show', array( $this->template->render('board/show', array(
'project' => $this->project->getById($project_id), 'project' => $this->project->getById($project_id),
'swimlanes' => $this->board->getBoard($project_id), 'swimlanes' => $this->board->getBoard($project_id),
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
'board_highlight_period' => $this->config->get('board_highlight_period'), 'board_highlight_period' => $this->config->get('board_highlight_period'),
)), )),
@@ -143,14 +132,10 @@ class Board extends Base
return $this->response->status(304); return $this->response->status(304);
} }
list($categories_listing, $categories_description) = $this->category->getBoardCategories($project_id);
$this->response->html( $this->response->html(
$this->template->render('board/show', array( $this->template->render('board/show', array(
'project' => $this->project->getById($project_id), 'project' => $this->project->getById($project_id),
'swimlanes' => $this->board->getBoard($project_id), 'swimlanes' => $this->board->getBoard($project_id),
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
'board_highlight_period' => $this->config->get('board_highlight_period'), 'board_highlight_period' => $this->config->get('board_highlight_period'),
)) ))

View File

@@ -73,38 +73,6 @@ class Category extends Base
->findOneColumn('id'); ->findOneColumn('id');
} }
/**
* Prepare categories to be displayed on the board
*
* @access public
* @param integer $project_id
* @return array
*/
public function getBoardCategories($project_id)
{
$descriptions = array();
$listing = array(
-1 => t('All categories'),
0 => t('No category'),
);
$categories = $this->db->table(self::TABLE)
->eq('project_id', $project_id)
->asc('name')
->findAll();
foreach ($categories as $category) {
$listing[$category['id']] = $category['name'];
$descriptions[$category['id']] = $category['description'];
}
return array(
$listing,
$descriptions,
);
}
/** /**
* Return the list of all categories * Return the list of all categories
* *

View File

@@ -100,6 +100,7 @@ class TaskFinder extends Base
User::TABLE.'.username AS assignee_username', User::TABLE.'.username AS assignee_username',
User::TABLE.'.name AS assignee_name', User::TABLE.'.name AS assignee_name',
Category::TABLE.'.name AS category_name', Category::TABLE.'.name AS category_name',
Category::TABLE.'.description AS category_description',
Board::TABLE.'.title AS column_name', Board::TABLE.'.title AS column_name',
Project::TABLE.'.name AS project_name' Project::TABLE.'.name AS project_name'
) )

View File

@@ -9,8 +9,6 @@
<?= $this->render('board/show', array( <?= $this->render('board/show', array(
'project' => $project, 'project' => $project,
'swimlanes' => $swimlanes, 'swimlanes' => $swimlanes,
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'board_private_refresh_interval' => $board_private_refresh_interval, 'board_private_refresh_interval' => $board_private_refresh_interval,
'board_highlight_period' => $board_highlight_period, 'board_highlight_period' => $board_highlight_period,
)) ?> )) ?>

View File

@@ -3,8 +3,6 @@
<?= $this->render('board/show', array( <?= $this->render('board/show', array(
'project' => $project, 'project' => $project,
'swimlanes' => $swimlanes, 'swimlanes' => $swimlanes,
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'board_private_refresh_interval' => $board_private_refresh_interval, 'board_private_refresh_interval' => $board_private_refresh_interval,
'board_highlight_period' => $board_highlight_period, 'board_highlight_period' => $board_highlight_period,
'not_editable' => true, 'not_editable' => true,

View File

@@ -21,8 +21,6 @@
'project' => $project, 'project' => $project,
'swimlane' => $swimlane, 'swimlane' => $swimlane,
'board_highlight_period' => $board_highlight_period, 'board_highlight_period' => $board_highlight_period,
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'hide_swimlane' => count($swimlanes) === 1, 'hide_swimlane' => count($swimlanes) === 1,
'not_editable' => isset($not_editable), 'not_editable' => isset($not_editable),
)) ?> )) ?>

View File

@@ -74,8 +74,6 @@
<?= $this->render($not_editable ? 'board/task_public' : 'board/task_private', array( <?= $this->render($not_editable ? 'board/task_public' : 'board/task_private', array(
'project' => $project, 'project' => $project,
'task' => $task, 'task' => $task,
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'board_highlight_period' => $board_highlight_period, 'board_highlight_period' => $board_highlight_period,
'not_editable' => $not_editable, 'not_editable' => $not_editable,
)) ?> )) ?>

View File

@@ -2,16 +2,16 @@
<div class="task-board-category-container"> <div class="task-board-category-container">
<span class="task-board-category"> <span class="task-board-category">
<?php if ($not_editable): ?> <?php if ($not_editable): ?>
<?= $this->text->in($task['category_id'], $categories_listing) ?> <?= $this->e($task['category_name']) ?>
<?php else: ?> <?php else: ?>
<?= $this->url->link( <?= $this->url->link(
$this->text->in($task['category_id'], $categories_listing), $this->e($task['category_name']),
'board', 'board',
'changeCategory', 'changeCategory',
array('task_id' => $task['id'], 'project_id' => $task['project_id']), array('task_id' => $task['id'], 'project_id' => $task['project_id']),
false, false,
'task-board-popover' . (isset($categories_description[$task['category_id']]) ? ' column-tooltip' : ''), 'task-board-popover' . (! empty($task['category_description']) ? ' column-tooltip' : ''),
isset($categories_description[$task['category_id']]) ? $this->text->markdown($categories_description[$task['category_id']]) : t('Change category') ! empty($task['category_description']) ? $this->text->markdown($task['category_description']) : t('Change category')
) ?> ) ?>
<?php endif ?> <?php endif ?>
</span> </span>

View File

@@ -42,8 +42,6 @@
<?= $this->render('board/task_footer', array( <?= $this->render('board/task_footer', array(
'task' => $task, 'task' => $task,
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'not_editable' => $not_editable, 'not_editable' => $not_editable,
)) ?> )) ?>
</div> </div>

View File

@@ -24,8 +24,6 @@
<?= $this->render('board/task_footer', array( <?= $this->render('board/task_footer', array(
'task' => $task, 'task' => $task,
'categories_listing' => $categories_listing,
'categories_description' => $categories_description,
'not_editable' => $not_editable, 'not_editable' => $not_editable,
)) ?> )) ?>
</div> </div>

View File

@@ -16,7 +16,7 @@
<?= $this->url->link(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?> <?= $this->url->link(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?>
</li> </li>
<li> <li>
<?= $this->url->link(t('Edit board'), 'column', 'index', array('project_id' => $project['id'])) ?> <?= $this->url->link(t('Columns'), 'column', 'index', array('project_id' => $project['id'])) ?>
</li> </li>
<li> <li>
<?= $this->url->link(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?> <?= $this->url->link(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?>