Hide tasks within specific columns in dashboard (#2424)

This commit is contained in:
Busfreak
2016-07-05 17:09:13 +02:00
committed by Frédéric Guillot
parent b215296f97
commit 6ccd8c11fa
36 changed files with 66 additions and 9 deletions

View File

@@ -66,7 +66,7 @@ class ColumnController extends BaseController
list($valid, $errors) = $this->columnValidator->validateCreation($values); list($valid, $errors) = $this->columnValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description']) !== false) { if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description'], $values['hide_in_dashboard']) !== false) {
$this->flash->success(t('Column created successfully.')); $this->flash->success(t('Column created successfully.'));
return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true);
} else { } else {
@@ -111,7 +111,7 @@ class ColumnController extends BaseController
list($valid, $errors) = $this->columnValidator->validateModification($values); list($valid, $errors) = $this->columnValidator->validateModification($values);
if ($valid) { if ($valid) {
if ($this->columnModel->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) { if ($this->columnModel->update($values['id'], $values['title'], $values['task_limit'], $values['description'], $values['hide_in_dashboard']) !== false) {
$this->flash->success(t('Board updated successfully.')); $this->flash->success(t('Board updated successfully.'));
return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
} else { } else {

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
'Global tags' => 'Globale Schlagwörter', 'Global tags' => 'Globale Schlagwörter',
'There is no global tag at the moment.' => 'Es gibt zur Zeit kein globales Schlagwort', 'There is no global tag at the moment.' => 'Es gibt zur Zeit kein globales Schlagwort',
'This field cannot be empty' => 'Dieses Feld kann nicht leer sein', 'This field cannot be empty' => 'Dieses Feld kann nicht leer sein',
'Hide tasks in this column in the Dashboard' => 'Aufgaben in dieser Spalte im Dashboard ausblenden',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1217,4 +1217,5 @@ return array(
'Global tags' => 'Libellés globaux', 'Global tags' => 'Libellés globaux',
'There is no global tag at the moment.' => 'Il n\'y a aucun libellé global pour le moment.', 'There is no global tag at the moment.' => 'Il n\'y a aucun libellé global pour le moment.',
'This field cannot be empty' => 'Ce champ ne peut être vide', 'This field cannot be empty' => 'Ce champ ne peut être vide',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
'Global tags' => 'Tag globali', 'Global tags' => 'Tag globali',
'There is no global tag at the moment.' => 'Non sono definiti tag globali al momento.', 'There is no global tag at the moment.' => 'Non sono definiti tag globali al momento.',
'This field cannot be empty' => 'Questo campo non può essere vuoto', 'This field cannot be empty' => 'Questo campo non può essere vuoto',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
//' Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
'Global tags' => 'Etiquetas globais', 'Global tags' => 'Etiquetas globais',
'There is no global tag at the moment.' => 'De momento não existe nenhuma etiqueta global.', 'There is no global tag at the moment.' => 'De momento não existe nenhuma etiqueta global.',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
//'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
'Global tags' => 'Глобальные метка', 'Global tags' => 'Глобальные метка',
'There is no global tag at the moment.' => 'Нет глобальных меток.', 'There is no global tag at the moment.' => 'Нет глобальных меток.',
'This field cannot be empty' => 'Это поле не может быть пустым', 'This field cannot be empty' => 'Это поле не может быть пустым',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -1216,4 +1216,5 @@ return array(
// 'Global tags' => '', // 'Global tags' => '',
// 'There is no global tag at the moment.' => '', // 'There is no global tag at the moment.' => '',
// 'This field cannot be empty' => '', // 'This field cannot be empty' => '',
// 'Hide tasks in this column in the Dashboard' => '',
); );

View File

@@ -144,13 +144,14 @@ class ColumnModel extends Base
* @param string $description Column description * @param string $description Column description
* @return boolean|integer * @return boolean|integer
*/ */
public function create($project_id, $title, $task_limit = 0, $description = '') public function create($project_id, $title, $task_limit = 0, $description = '', $hide_in_dashboard = 0)
{ {
$values = array( $values = array(
'project_id' => $project_id, 'project_id' => $project_id,
'title' => $title, 'title' => $title,
'task_limit' => intval($task_limit), 'task_limit' => intval($task_limit),
'position' => $this->getLastColumnPosition($project_id) + 1, 'position' => $this->getLastColumnPosition($project_id) + 1,
'hide_in_dashboard' => $hide_in_dashboard,
'description' => $description, 'description' => $description,
); );
@@ -167,11 +168,12 @@ class ColumnModel extends Base
* @param string $description Optional description * @param string $description Optional description
* @return boolean * @return boolean
*/ */
public function update($column_id, $title, $task_limit = 0, $description = '') public function update($column_id, $title, $task_limit = 0, $description = '', $hide_in_dashboard = 0)
{ {
return $this->db->table(self::TABLE)->eq('id', $column_id)->update(array( return $this->db->table(self::TABLE)->eq('id', $column_id)->update(array(
'title' => $title, 'title' => $title,
'task_limit' => intval($task_limit), 'task_limit' => intval($task_limit),
'hide_in_dashboard' => $hide_in_dashboard,
'description' => $description, 'description' => $description,
)); ));
} }

View File

@@ -81,7 +81,8 @@ class TaskFinderModel extends Base
->join(ColumnModel::TABLE, 'id', 'column_id') ->join(ColumnModel::TABLE, 'id', 'column_id')
->eq(TaskModel::TABLE.'.owner_id', $user_id) ->eq(TaskModel::TABLE.'.owner_id', $user_id)
->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN) ->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN)
->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE); ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE)
->eq(ColumnModel::TABLE.'.hide_in_dashboard', 0);
} }
/** /**

View File

@@ -6,7 +6,12 @@ use PDO;
use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role; use Kanboard\Core\Security\Role;
const VERSION = 111; const VERSION = 112;
function version_112(PDO $pdo)
{
$pdo->exec('ALTER TABLE columns ADD COLUMN hide_in_dashboard INT DEFAULT 0 NOT NULL');
}
function version_111(PDO $pdo) function version_111(PDO $pdo)
{ {

View File

@@ -6,7 +6,12 @@ use PDO;
use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role; use Kanboard\Core\Security\Role;
const VERSION = 90; const VERSION = 91;
function version_91(PDO $pdo)
{
$pdo->exec("ALTER TABLE columns ADD COLUMN hide_in_dashboard BOOLEAN DEFAULT '0'");
}
function version_90(PDO $pdo) function version_90(PDO $pdo)
{ {

View File

@@ -44,6 +44,7 @@ CREATE TABLE `columns` (
`position` int(11) NOT NULL, `position` int(11) NOT NULL,
`project_id` int(11) NOT NULL, `project_id` int(11) NOT NULL,
`task_limit` int(11) DEFAULT '0', `task_limit` int(11) DEFAULT '0',
`hide_in_dashboard` int(11) DEFAULT '0',
`description` text, `description` text,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `idx_title_project` (`title`,`project_id`), UNIQUE KEY `idx_title_project` (`title`,`project_id`),

View File

@@ -98,6 +98,7 @@ CREATE TABLE "columns" (
"position" integer, "position" integer,
"project_id" integer NOT NULL, "project_id" integer NOT NULL,
"task_limit" integer DEFAULT 0, "task_limit" integer DEFAULT 0,
"hide_in_dashboard" integer DEFAULT 0,
"description" "text" "description" "text"
); );

View File

@@ -6,7 +6,12 @@ use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role; use Kanboard\Core\Security\Role;
use PDO; use PDO;
const VERSION = 102; const VERSION = 103;
function version_103(PDO $pdo)
{
$pdo->exec("ALTER TABLE columns ADD COLUMN hide_in_dashboard INTEGER DEFAULT 0 NOT NULL");
}
function version_102(PDO $pdo) function version_102(PDO $pdo)
{ {

View File

@@ -13,6 +13,8 @@
<?= $this->form->label(t('Task limit'), 'task_limit') ?> <?= $this->form->label(t('Task limit'), 'task_limit') ?>
<?= $this->form->number('task_limit', $values, $errors) ?> <?= $this->form->number('task_limit', $values, $errors) ?>
<?= $this->form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the Dashboard'), 1) ?>
<?= $this->form->label(t('Description'), 'description') ?> <?= $this->form->label(t('Description'), 'description') ?>
<?= $this->form->textarea('description', $values, $errors, array(), 'markdown-editor') ?> <?= $this->form->textarea('description', $values, $errors, array(), 'markdown-editor') ?>

View File

@@ -15,6 +15,8 @@
<?= $this->form->label(t('Task limit'), 'task_limit') ?> <?= $this->form->label(t('Task limit'), 'task_limit') ?>
<?= $this->form->number('task_limit', $values, $errors) ?> <?= $this->form->number('task_limit', $values, $errors) ?>
<?= $this->form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the Dashboard'), 1, $values['hide_in_dashboard'] == 1) ?>
<?= $this->form->label(t('Description'), 'description') ?> <?= $this->form->label(t('Description'), 'description') ?>
<?= $this->form->textarea('description', $values, $errors, array(), 'markdown-editor') ?> <?= $this->form->textarea('description', $values, $errors, array(), 'markdown-editor') ?>

View File

@@ -54,9 +54,10 @@
</div> </div>
<table class="table-stripped"> <table class="table-stripped">
<tr> <tr>
<th class="column-60"><?= t('Column') ?></th> <th class="column-40"><?= t('Column') ?></th>
<th class="column-20"><?= t('Task limit') ?></th> <th class="column-20"><?= t('Task limit') ?></th>
<th class="column-20"><?= t('Active tasks') ?></th> <th class="column-20"><?= t('Active tasks') ?></th>
<th class="column-20"><?= t('Hide tasks in this column in the Dashboard') ?></th>
</tr> </tr>
<?php foreach ($stats['columns'] as $column): ?> <?php foreach ($stats['columns'] as $column): ?>
<tr> <tr>
@@ -70,6 +71,13 @@
</td> </td>
<td><?= $column['task_limit'] ?: '∞' ?></td> <td><?= $column['task_limit'] ?: '∞' ?></td>
<td><?= $column['nb_active_tasks'] ?></td> <td><?= $column['nb_active_tasks'] ?></td>
<td>
<?php if ($column['hide_in_dashboard'] == 1): ?>
<?= t('Yes') ?>
<?php else: ?>
<?= t('No') ?>
<?php endif ?>
</td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</table> </table>