summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-01 20:55:21 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-01 20:55:21 -0400
commit747b9434d3ef82f55d96185c5afa6d155642ba15 (patch)
treec36610d5856f11e399e0d1f4f3442b8ede8ff687
parent471e46e70294684efc6d7edfc814d5b9ca04738b (diff)
Remove method Category::getBoardCategories()
-rw-r--r--app/Controller/Board.php17
-rw-r--r--app/Model/Category.php32
-rw-r--r--app/Model/TaskFinder.php1
-rw-r--r--app/Template/board/index.php2
-rw-r--r--app/Template/board/public.php2
-rw-r--r--app/Template/board/show.php2
-rw-r--r--app/Template/board/swimlane.php2
-rw-r--r--app/Template/board/task_footer.php8
-rw-r--r--app/Template/board/task_private.php2
-rw-r--r--app/Template/board/task_public.php2
-rw-r--r--app/Template/project/sidebar.php2
11 files changed, 7 insertions, 65 deletions
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index 433d3af1..0f38f910 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -26,14 +26,10 @@ class Board extends Base
$this->forbidden(true);
}
- list($categories_listing, $categories_description) = $this->category->getBoardCategories($project['id']);
-
// Display the board with a specific layout
$this->response->html($this->template->layout('board/public', array(
'project' => $project,
'swimlanes' => $this->board->getBoard($project['id']),
- 'categories_listing' => $categories_listing,
- 'categories_description' => $categories_description,
'title' => $project['name'],
'description' => $project['description'],
'no_layout' => true,
@@ -58,15 +54,12 @@ class Board extends Base
$board_selector = $projects;
unset($board_selector[$project['id']]);
- list($categories_listing, $categories_description) = $this->category->getBoardCategories($project['id']);
-
$this->response->html($this->template->layout('board/index', array(
'users' => $this->projectPermission->getMemberList($project['id'], true, true),
'projects' => $projects,
'project' => $project,
'swimlanes' => $this->board->getBoard($project['id']),
- 'categories_listing' => $categories_listing,
- 'categories_description' => $categories_description,
+ 'categories_listing' => $this->category->getList($project['id'], true, true),
'title' => $project['name'],
'description' => $project['description'],
'board_selector' => $board_selector,
@@ -106,14 +99,10 @@ class Board extends Base
return $this->response->status(400);
}
- list($categories_listing, $categories_description) = $this->category->getBoardCategories($project_id);
-
$this->response->html(
$this->template->render('board/show', array(
'project' => $this->project->getById($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_highlight_period' => $this->config->get('board_highlight_period'),
)),
@@ -143,14 +132,10 @@ class Board extends Base
return $this->response->status(304);
}
- list($categories_listing, $categories_description) = $this->category->getBoardCategories($project_id);
-
$this->response->html(
$this->template->render('board/show', array(
'project' => $this->project->getById($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_highlight_period' => $this->config->get('board_highlight_period'),
))
diff --git a/app/Model/Category.php b/app/Model/Category.php
index dcc0f88e..f50c0f48 100644
--- a/app/Model/Category.php
+++ b/app/Model/Category.php
@@ -74,38 +74,6 @@ class Category extends Base
}
/**
- * 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
*
* @access public
diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php
index 181ff360..f061cef0 100644
--- a/app/Model/TaskFinder.php
+++ b/app/Model/TaskFinder.php
@@ -100,6 +100,7 @@ class TaskFinder extends Base
User::TABLE.'.username AS assignee_username',
User::TABLE.'.name AS assignee_name',
Category::TABLE.'.name AS category_name',
+ Category::TABLE.'.description AS category_description',
Board::TABLE.'.title AS column_name',
Project::TABLE.'.name AS project_name'
)
diff --git a/app/Template/board/index.php b/app/Template/board/index.php
index f87e0077..6f6fddbe 100644
--- a/app/Template/board/index.php
+++ b/app/Template/board/index.php
@@ -9,8 +9,6 @@
<?= $this->render('board/show', array(
'project' => $project,
'swimlanes' => $swimlanes,
- 'categories_listing' => $categories_listing,
- 'categories_description' => $categories_description,
'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
index 9e5360ce..ad7515db 100644
--- a/app/Template/board/public.php
+++ b/app/Template/board/public.php
@@ -3,8 +3,6 @@
<?= $this->render('board/show', array(
'project' => $project,
'swimlanes' => $swimlanes,
- 'categories_listing' => $categories_listing,
- 'categories_description' => $categories_description,
'board_private_refresh_interval' => $board_private_refresh_interval,
'board_highlight_period' => $board_highlight_period,
'not_editable' => true,
diff --git a/app/Template/board/show.php b/app/Template/board/show.php
index 3b10d82c..c0aa5d36 100644
--- a/app/Template/board/show.php
+++ b/app/Template/board/show.php
@@ -21,8 +21,6 @@
'project' => $project,
'swimlane' => $swimlane,
'board_highlight_period' => $board_highlight_period,
- 'categories_listing' => $categories_listing,
- 'categories_description' => $categories_description,
'hide_swimlane' => count($swimlanes) === 1,
'not_editable' => isset($not_editable),
)) ?>
diff --git a/app/Template/board/swimlane.php b/app/Template/board/swimlane.php
index 201ee2fc..b86fc446 100644
--- a/app/Template/board/swimlane.php
+++ b/app/Template/board/swimlane.php
@@ -74,8 +74,6 @@
<?= $this->render($not_editable ? 'board/task_public' : 'board/task_private', array(
'project' => $project,
'task' => $task,
- 'categories_listing' => $categories_listing,
- 'categories_description' => $categories_description,
'board_highlight_period' => $board_highlight_period,
'not_editable' => $not_editable,
)) ?>
diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php
index 55161921..7593c102 100644
--- a/app/Template/board/task_footer.php
+++ b/app/Template/board/task_footer.php
@@ -2,16 +2,16 @@
<div class="task-board-category-container">
<span class="task-board-category">
<?php if ($not_editable): ?>
- <?= $this->text->in($task['category_id'], $categories_listing) ?>
+ <?= $this->e($task['category_name']) ?>
<?php else: ?>
<?= $this->url->link(
- $this->text->in($task['category_id'], $categories_listing),
+ $this->e($task['category_name']),
'board',
'changeCategory',
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
false,
- 'task-board-popover' . (isset($categories_description[$task['category_id']]) ? ' column-tooltip' : ''),
- isset($categories_description[$task['category_id']]) ? $this->text->markdown($categories_description[$task['category_id']]) : t('Change category')
+ 'task-board-popover' . (! empty($task['category_description']) ? ' column-tooltip' : ''),
+ ! empty($task['category_description']) ? $this->text->markdown($task['category_description']) : t('Change category')
) ?>
<?php endif ?>
</span>
diff --git a/app/Template/board/task_private.php b/app/Template/board/task_private.php
index 77f3b958..44ce9d97 100644
--- a/app/Template/board/task_private.php
+++ b/app/Template/board/task_private.php
@@ -42,8 +42,6 @@
<?= $this->render('board/task_footer', array(
'task' => $task,
- 'categories_listing' => $categories_listing,
- 'categories_description' => $categories_description,
'not_editable' => $not_editable,
)) ?>
</div>
diff --git a/app/Template/board/task_public.php b/app/Template/board/task_public.php
index 9ac6e570..bacdcef4 100644
--- a/app/Template/board/task_public.php
+++ b/app/Template/board/task_public.php
@@ -24,8 +24,6 @@
<?= $this->render('board/task_footer', array(
'task' => $task,
- 'categories_listing' => $categories_listing,
- 'categories_description' => $categories_description,
'not_editable' => $not_editable,
)) ?>
</div> \ No newline at end of file
diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php
index a58c4604..3762f1ff 100644
--- a/app/Template/project/sidebar.php
+++ b/app/Template/project/sidebar.php
@@ -16,7 +16,7 @@
<?= $this->url->link(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?>
</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>
<?= $this->url->link(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?>