diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-02-14 21:03:25 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-02-14 21:03:25 -0500 |
commit | 7c4bdea324d8074ffcc3fa353fcfd85ee8066634 (patch) | |
tree | 2542a985fd47d3dce14c06e6872febb34751d302 | |
parent | 2eec0185ab2af2bd51356423152ec4a4374bb78e (diff) |
Add board filter: collapse/expand tasks
24 files changed, 242 insertions, 126 deletions
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index b6186a33..44d3c9f8 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index f954ce78..e768c33c 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 60a90c9a..997d0d50 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 42054646..facbafdd 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 26372c48..a6981662 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -724,4 +724,6 @@ return array( '<1h' => '<1h', '%dh' => '%dh', '%b %e' => '%e %b', + 'Expand tasks' => 'Déplier les tâches', + 'Collapse tasks' => 'Replier les tâches', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index 487492b2..8407ca55 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index f395caff..dc369ba3 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index ab62128c..e6cfe83e 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 688230fa..c1583cd8 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index d7759fc8..30c4dca3 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 0afd3643..ebaca4fc 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index c9a9b041..6a6d0973 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 502b1135..f78f198a 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 75690708..45d9203a 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -722,4 +722,6 @@ return array( // '<1h' => '', // '%dh' => '', // '%b %e' => '', + // 'Expand tasks' => '', + // 'Collapse tasks' => '', ); diff --git a/app/Template/board/filters.php b/app/Template/board/filters.php index 0e9c4d5f..db2108ab 100644 --- a/app/Template/board/filters.php +++ b/app/Template/board/filters.php @@ -46,5 +46,13 @@ <li> <a href="#" id="filter-due-date"><?= t('Filter by due date') ?></a> </li> + <li> + <span class="filter-collapse"> + <i class="fa fa-compress"></i> <a href="#" class="filter-collapse-link"><?= t('Collapse tasks') ?></a> + </span> + <span class="filter-expand" style="display: none"> + <i class="fa fa-expand"></i> <a href="#" class="filter-expand-link"><?= t('Expand tasks') ?></a> + </span> + </li> </ul> </div>
\ No newline at end of file diff --git a/app/Template/board/show.php b/app/Template/board/show.php index 5fbb576c..dc524737 100644 --- a/app/Template/board/show.php +++ b/app/Template/board/show.php @@ -1,4 +1,3 @@ - <?php if (isset($not_editable)): ?> <table id="board"> <?php else: ?> @@ -25,4 +24,4 @@ )) ?> <?php endif ?> <?php endforeach ?> -</table> +</table>
\ No newline at end of file diff --git a/app/Template/board/swimlane.php b/app/Template/board/swimlane.php index f0a00fc1..ec5272f3 100644 --- a/app/Template/board/swimlane.php +++ b/app/Template/board/swimlane.php @@ -26,13 +26,13 @@ <?php endif ?> <?= $this->e($column['title']) ?> - + <?php if (! empty($column['description'])): ?> - <span class="column-tooltip pull-right" title="<?= $this->markdown($column['description']) ?>"> + <span class="column-tooltip pull-right" title="<?= $this->markdown($column['description']) ?>"> <i class="fa fa-info-circle"></i> </span> <?php endif ?> - + <?php if ($column['task_limit']): ?> <span title="<?= t('Task limit') ?>" class="task-limit"> (<span id="task-number-column-<?= $column['id'] ?>"><?= $column['nb_tasks'] ?></span>/<?= $this->e($column['task_limit']) ?>) @@ -65,7 +65,7 @@ <?php endif ?> <?php foreach ($column['tasks'] as $task): ?> - <?= $this->render('board/task', array( + <?= $this->render($not_editable ? 'board/task_public' : 'board/task', array( 'project' => $project, 'task' => $task, 'categories' => $categories, diff --git a/app/Template/board/task.php b/app/Template/board/task.php index 638078c3..5f73a5c2 100644 --- a/app/Template/board/task.php +++ b/app/Template/board/task.php @@ -1,31 +1,3 @@ -<?php if ($not_editable): ?> - -<div class="task-board color-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>"> - - <?= $this->a('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> - - <?php if ($task['reference']): ?> - <span class="task-board-reference" title="<?= t('Reference') ?>"> - (<?= $task['reference'] ?>) - </span> - <?php endif ?> - - - - - <span class="task-board-user"> - <?php if (! empty($task['owner_id'])): ?> - <?= t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?> - <?php else: ?> - <span class="task-board-nobody"><?= t('Nobody assigned') ?></span> - <?php endif ?> - </span> - - <div class="task-board-title"> - <?= $this->a($this->e($task['title']), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> - </div> - -<?php else: ?> - <div class="task-board draggable-item color-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>" data-task-id="<?= $task['id'] ?>" data-owner-id="<?= $task['owner_id'] ?>" @@ -34,91 +6,51 @@ data-task-url="<?= $this->u('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" title="<?= t('View this task') ?>"> - <ul class="dropdown"> - <li> - <a href="#" class="dropdown-menu"><?= '#'.$task['id'] ?></a> - <ul> - <li><i class="fa fa-user"></i> <?= $this->a(t('Change assignee'), 'board', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'assignee-popover') ?></li> - <li><i class="fa fa-tag"></i> <?= $this->a(t('Change category'), 'board', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'category-popover') ?></li> - <li><i class="fa fa-align-left"></i> <?= $this->a(t('Change description'), 'task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-description-popover') ?></li> - <li><i class="fa fa-pencil-square-o"></i> <?= $this->a(t('Edit this task'), 'task', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-edit-popover') ?></li> - <li><i class="fa fa-close"></i> <?= $this->a(t('Close this task'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes', 'redirect' => 'board'), true) ?></li> - </li> - </li> - </ul> - - <?php if ($task['reference']): ?> - <span class="task-board-reference" title="<?= t('Reference') ?>"> - (<?= $task['reference'] ?>) - </span> - <?php endif ?> - - <span class="task-board-user <?= $this->userSession->isCurrentUser($task['owner_id']) ? 'task-board-current-user' : '' ?>"> - <?= $this->a( - (! empty($task['owner_id']) ? ($task['assignee_name'] ?: $task['assignee_username']) : t('Nobody assigned')), - 'board', - 'changeAssignee', - array('task_id' => $task['id'], 'project_id' => $task['project_id']), - false, - 'assignee-popover', - t('Change assignee') - ) ?> - </span> - - <span title="<?= t('Task age in days')?>" class="task-days-age"><?= $this->getTaskAge($task['date_creation']) ?></span> - <span title="<?= t('Days in this column')?>" class="task-days-incolumn"><?= $this->getTaskAge($task['date_moved']) ?></span> - - <div class="task-board-title"> - <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + <div class="task-board-collapsed" style="display: none"> + <?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-id') ?> + <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-collapsed-title') ?> </div> -<?php endif ?> - - -<?php if ($task['category_id']): ?> -<div class="task-board-category-container"> - <span class="task-board-category"> - <?= $this->a( - $this->inList($task['category_id'], $categories), - 'board', - 'changeCategory', - array('task_id' => $task['id'], 'project_id' => $task['project_id']), - false, - 'category-popover', - t('Change category') - ) ?> - </span> -</div> -<?php endif ?> + <div class="task-board-expanded"> + + <ul class="dropdown"> + <li> + <a href="#" class="dropdown-menu"><?= '#'.$task['id'] ?></a> + <ul> + <li><i class="fa fa-user"></i> <?= $this->a(t('Change assignee'), 'board', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'assignee-popover') ?></li> + <li><i class="fa fa-tag"></i> <?= $this->a(t('Change category'), 'board', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'category-popover') ?></li> + <li><i class="fa fa-align-left"></i> <?= $this->a(t('Change description'), 'task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-description-popover') ?></li> + <li><i class="fa fa-pencil-square-o"></i> <?= $this->a(t('Edit this task'), 'task', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-edit-popover') ?></li> + <li><i class="fa fa-close"></i> <?= $this->a(t('Close this task'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes', 'redirect' => 'board'), true) ?></li> + </li> + </li> + </ul> -<div class="task-board-icons"> - <?php if (! empty($task['date_due'])): ?> - <span class="task-board-date <?= time() > $task['date_due'] ? 'task-board-date-overdue' : '' ?>"> - <i class="fa fa-calendar"></i> <?= dt('%b %e', $task['date_due']) ?> + <?php if ($task['reference']): ?> + <span class="task-board-reference" title="<?= t('Reference') ?>"> + (<?= $task['reference'] ?>) + </span> + <?php endif ?> + + <span class="task-board-user <?= $this->userSession->isCurrentUser($task['owner_id']) ? 'task-board-current-user' : '' ?>"> + <?= $this->a( + (! empty($task['owner_id']) ? ($task['assignee_name'] ?: $task['assignee_username']) : t('Nobody assigned')), + 'board', + 'changeAssignee', + array('task_id' => $task['id'], 'project_id' => $task['project_id']), + false, + 'assignee-popover', + t('Change assignee') + ) ?> </span> - <?php endif ?> - - <?php if (! empty($task['nb_links'])): ?> - <span title="<?= t('Links') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= $task['nb_links'] ?> <i class="fa fa-code-fork"></i></span> - <?php endif ?> - - <?php if (! empty($task['nb_subtasks'])): ?> - <span title="<?= t('Sub-Tasks') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'subtasks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?> <i class="fa fa-bars"></i></span> - <?php endif ?> - - <?php if (! empty($task['nb_files'])): ?> - <span title="<?= t('Attachments') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'attachments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= $task['nb_files'] ?> <i class="fa fa-paperclip"></i></span> - <?php endif ?> - <?php if (! empty($task['nb_comments'])): ?> - <span title="<?= p($task['nb_comments'], t('%d comment', $task['nb_comments']), t('%d comments', $task['nb_comments'])) ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'comments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= $task['nb_comments'] ?> <i class="fa fa-comment-o"></i></span> - <?php endif ?> + <span title="<?= t('Task age in days')?>" class="task-days-age"><?= $this->getTaskAge($task['date_creation']) ?></span> + <span title="<?= t('Days in this column')?>" class="task-days-incolumn"><?= $this->getTaskAge($task['date_moved']) ?></span> - <?php if (! empty($task['description'])): ?> - <span title="<?= t('Description') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> - <i class="fa fa-file-text-o"></i> - </span> - <?php endif ?> -</div> + <div class="task-board-title"> + <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?> + </div> + <?= $this->render('board/task_footer', array('task' => $task, 'categories' => $categories)) ?> + </div> </div> diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php new file mode 100644 index 00000000..04d425e8 --- /dev/null +++ b/app/Template/board/task_footer.php @@ -0,0 +1,45 @@ +<?php if ($task['category_id']): ?> +<div class="task-board-category-container"> + <span class="task-board-category"> + <?= $this->a( + $this->inList($task['category_id'], $categories), + 'board', + 'changeCategory', + array('task_id' => $task['id'], 'project_id' => $task['project_id']), + false, + 'category-popover', + t('Change category') + ) ?> + </span> +</div> +<?php endif ?> + +<div class="task-board-icons"> + <?php if (! empty($task['date_due'])): ?> + <span class="task-board-date <?= time() > $task['date_due'] ? 'task-board-date-overdue' : '' ?>"> + <i class="fa fa-calendar"></i> <?= dt('%b %e', $task['date_due']) ?> + </span> + <?php endif ?> + + <?php if (! empty($task['nb_links'])): ?> + <span title="<?= t('Links') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= $task['nb_links'] ?> <i class="fa fa-code-fork"></i></span> + <?php endif ?> + + <?php if (! empty($task['nb_subtasks'])): ?> + <span title="<?= t('Sub-Tasks') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'subtasks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= round($task['nb_completed_subtasks']/$task['nb_subtasks']*100, 0).'%' ?> <i class="fa fa-bars"></i></span> + <?php endif ?> + + <?php if (! empty($task['nb_files'])): ?> + <span title="<?= t('Attachments') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'attachments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= $task['nb_files'] ?> <i class="fa fa-paperclip"></i></span> + <?php endif ?> + + <?php if (! empty($task['nb_comments'])): ?> + <span title="<?= p($task['nb_comments'], t('%d comment', $task['nb_comments']), t('%d comments', $task['nb_comments'])) ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'comments', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><?= $task['nb_comments'] ?> <i class="fa fa-comment-o"></i></span> + <?php endif ?> + + <?php if (! empty($task['description'])): ?> + <span title="<?= t('Description') ?>" class="task-board-tooltip" data-href="<?= $this->u('board', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + <i class="fa fa-file-text-o"></i> + </span> + <?php endif ?> +</div>
\ No newline at end of file diff --git a/app/Template/board/task_public.php b/app/Template/board/task_public.php new file mode 100644 index 00000000..4e3ad18c --- /dev/null +++ b/app/Template/board/task_public.php @@ -0,0 +1,26 @@ +<div class="task-board color-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>"> + + <?= $this->a('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> + + <?php if ($task['reference']): ?> + <span class="task-board-reference" title="<?= t('Reference') ?>"> + (<?= $task['reference'] ?>) + </span> + <?php endif ?> + + - + + <span class="task-board-user"> + <?php if (! empty($task['owner_id'])): ?> + <?= t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?> + <?php else: ?> + <span class="task-board-nobody"><?= t('Nobody assigned') ?></span> + <?php endif ?> + </span> + + <div class="task-board-title"> + <?= $this->a($this->e($task['title']), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?> + </div> + + <?= $this->render('board/task_footer', array('task' => $task, 'categories' => $categories)) ?> +</div>
\ No newline at end of file diff --git a/assets/css/app.css b/assets/css/app.css index 8a0ad307..96705433 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -817,6 +817,16 @@ div.task-board-recent { text-decoration: underline; } +.task-board-collapsed { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +a.task-board-collapsed-title { + font-weight: normal; +} + .task-board-title { margin-top: 10px; font-size: 1.1em; diff --git a/assets/css/src/task.css b/assets/css/src/task.css index 7a5b61c9..77bcc48c 100644 --- a/assets/css/src/task.css +++ b/assets/css/src/task.css @@ -26,6 +26,16 @@ div.task-board-recent { text-decoration: underline; } +.task-board-collapsed { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +a.task-board-collapsed-title { + font-weight: normal; +} + .task-board-title { margin-top: 10px; font-size: 1.1em; diff --git a/assets/js/app.js b/assets/js/app.js index c1b3ef37..7175ad43 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -141,14 +141,15 @@ return""!=a?"visible"==document[a]:!0},SetStorageItem:function(a,c){"undefined"! c.parent().addClass("form-tab-selected");e.find(".markdown").html(a);e.css("height",f.css("height"));e.css("width",f.css("width"));d.hide();e.show()})},MarkdownWriter:function(a){a.preventDefault();$(this).closest("ul").find("li").removeClass("form-tab-selected");$(this).parent().addClass("form-tab-selected");$(".write-area").show();$(".preview-area").hide()},CheckSession:function(){$(".form-login").length||$.ajax({cache:!1,url:$("body").data("status-url"),statusCode:{401:function(a){window.location= $("body").data("login-url")}}})},Init:function(){$("#board-selector").chosen({width:180});$("#board-selector").change(function(){window.location=$(this).attr("data-board-url").replace(/PROJECT_ID/g,$(this).val())});window.setInterval(Kanboard.CheckSession,6E4);$(".popover-subtask-restriction").click(Kanboard.Popover);$(".file-popover").click(Kanboard.Popover);Mousetrap.bind("ctrl+enter",function(){$("form").submit()});$(".column-tooltip").tooltip({content:function(a){return'<div class="markdown">'+ $(this).attr("title")+"</div>"}});$.datepicker.setDefaults($.datepicker.regional[$("body").data("js-lang")]);Kanboard.InitAfterAjax()},InitAfterAjax:function(){$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:"yy-mm-dd",constrainInput:!1});$("#markdown-preview").click(Kanboard.MarkdownPreview);$("#markdown-write").click(Kanboard.MarkdownWriter);$(".auto-select").focus(function(){$(this).select()});$(".dropit-submenu").hide();$(".dropdown").not(".dropit").dropit()}}}(); -Kanboard.Board=function(){function a(a){Kanboard.Popover(a,Kanboard.InitAfterAjax)}function c(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($(".task-creation-popover").attr("href"),Kanboard.InitAfterAjax)})}function b(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){e(b.item.attr("data-task-id"),b.item.parent().attr("data-column-id"),b.item.index()+1,b.item.parent().attr("data-swimlane-id"))}});$(".assignee-popover").click(a); -$(".category-popover").click(a);$(".task-edit-popover").click(a);$(".task-creation-popover").click(a);$(".task-description-popover").click(a);$(".task-board-tooltip").tooltip({track:!1,position:{my:"left-20 top",at:"center bottom+9",using:function(a,b){$(this).css(a);var c=b.target.left+b.target.width/2-b.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(b.vertical).addClass(0==c?"align-left":"align-right").appendTo(this)}},content:function(a){if(a=$(this).attr("data-href")){var b=this; -$.get(a,function l(a){$(".ui-tooltip-content:visible").html(a);a=$(".ui-tooltip:visible");a.css({top:"",left:""});a.children(".tooltip-arrow").remove();var c=$(b).tooltip("option","position");c.of=$(b);a.position(c);$("#tooltip-subtasks a").click(function(a){a.preventDefault();a.stopPropagation();$(this).hasClass("popover-subtask-restriction")?(Kanboard.OpenPopover($(this).attr("href")),$(b).tooltip("close")):$.get($(this).attr("href"),l)})});return'<i class="fa fa-refresh fa-spin fa-2x"></i>'}}}).on("mouseenter", -function(){var a=this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(a).tooltip("close")})}).on("mouseleave focusout",function(a){a.stopImmediatePropagation();var b=this;setTimeout(function(){$(".ui-tooltip:hover").length||$(b).tooltip("close")},100)});$("[data-task-url]").each(function(){$(this).click(function(){window.location=$(this).attr("data-task-url")})});var b=parseInt($("#board").attr("data-check-interval"));0<b&&(k=window.setInterval(f,1E3*b))}function d(){$("[data-task-url]").off(); -clearInterval(k)}function e(a,c,e,h){d();$.ajax({cache:!1,url:$("#board").attr("data-save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a,column_id:c,swimlane_id:h,position:e}),success:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();b();g()}})}function f(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax(); -d();b();g()}}})}function g(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),d=$("#board").data("project-id");$("[data-task-id]").each(function(d,g){var e=g.getAttribute("data-owner-id"),h=g.getAttribute("data-due-date"),f=g.getAttribute("data-category-id");g.style.opacity=e!=a&&-1!=a?"0.2":"1.0";!c||""!=h&&"0"!=h||(g.style.opacity="0.2");f!=b&&-1!=b&&(g.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+d+"_form-user_id",a); -Kanboard.SetStorageItem("board_filter_"+d+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+d+"_filter-due-date",~~c)}function h(){var a=$("#board").data("project-id");$("#form-user_id").change(g);$("#form-category_id").change(g);$("#filter-due-date").click(function(a){$(this).toggleClass("filter-on");g();a.preventDefault()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-category_id")|| --1);+Kanboard.GetStorageItem("board_filter_"+a+"_filter-due-date")?$("#filter-due-date").addClass("filter-on"):$("#filter-due-date").removeClass("filter-on");g()}var k=null;jQuery(document).ready(function(){Kanboard.Exists("board")&&(b(),h(),c())})}(); +Kanboard.Board=function(){function a(a){Kanboard.Popover(a,Kanboard.InitAfterAjax)}function c(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($(".task-creation-popover").attr("href"),Kanboard.InitAfterAjax)})}function b(){$(".filter-expand-link").click(function(a){a.preventDefault();f();Kanboard.SetStorageItem(d(),"expanded")});$(".filter-collapse-link").click(function(a){a.preventDefault();e();Kanboard.SetStorageItem(d(),"collapsed")});k()}function d(){return"board_stacking_"+$("#board").data("project-id")} +function e(){$(".filter-collapse").hide();$(".task-board-collapsed").show();$(".filter-expand").show();$(".task-board-expanded").hide()}function f(){$(".filter-collapse").show();$(".task-board-collapsed").hide();$(".filter-expand").hide();$(".task-board-expanded").show()}function k(){"expanded"===(Kanboard.GetStorageItem(d())||"expanded")?f():e()}function g(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){n(b.item.attr("data-task-id"), +b.item.parent().attr("data-column-id"),b.item.index()+1,b.item.parent().attr("data-swimlane-id"))}});$(".assignee-popover").click(a);$(".category-popover").click(a);$(".task-edit-popover").click(a);$(".task-creation-popover").click(a);$(".task-description-popover").click(a);$(".task-board-tooltip").tooltip({track:!1,position:{my:"left-20 top",at:"center bottom+9",using:function(a,b){$(this).css(a);var c=b.target.left+b.target.width/2-b.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(b.vertical).addClass(0== +c?"align-left":"align-right").appendTo(this)}},content:function(a){if(a=$(this).attr("data-href")){var b=this;$.get(a,function p(a){$(".ui-tooltip-content:visible").html(a);a=$(".ui-tooltip:visible");a.css({top:"",left:""});a.children(".tooltip-arrow").remove();var c=$(b).tooltip("option","position");c.of=$(b);a.position(c);$("#tooltip-subtasks a").click(function(a){a.preventDefault();a.stopPropagation();$(this).hasClass("popover-subtask-restriction")?(Kanboard.OpenPopover($(this).attr("href")),$(b).tooltip("close")): +$.get($(this).attr("href"),p)})});return'<i class="fa fa-refresh fa-spin fa-2x"></i>'}}}).on("mouseenter",function(){var a=this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(a).tooltip("close")})}).on("mouseleave focusout",function(a){a.stopImmediatePropagation();var b=this;setTimeout(function(){$(".ui-tooltip:hover").length||$(b).tooltip("close")},100)});$("[data-task-url]").each(function(){$(this).click(function(){window.location=$(this).attr("data-task-url")})});var b=parseInt($("#board").attr("data-check-interval")); +0<b&&(l=window.setInterval(q,1E3*b))}function m(){$("[data-task-url]").off();clearInterval(l)}function n(a,b,c,d){m();$.ajax({cache:!1,url:$("#board").attr("data-save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a,column_id:b,swimlane_id:d,position:c}),success:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();g();h();k()}})}function q(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove(); +$("#main").append(a);Kanboard.InitAfterAjax();m();g();h();k()}}})}function h(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),d=$("#board").data("project-id");$("[data-task-id]").each(function(d,e){var k=e.getAttribute("data-owner-id"),g=e.getAttribute("data-due-date"),f=e.getAttribute("data-category-id");e.style.opacity=k!=a&&-1!=a?"0.2":"1.0";!c||""!=g&&"0"!=g||(e.style.opacity="0.2");f!=b&&-1!=b&&(e.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+ +d+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+d+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+d+"_filter-due-date",~~c)}function r(){var a=$("#board").data("project-id");$("#form-user_id").change(h);$("#form-category_id").change(h);$("#filter-due-date").click(function(a){$(this).toggleClass("filter-on");h();a.preventDefault()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+ +a+"_form-category_id")||-1);+Kanboard.GetStorageItem("board_filter_"+a+"_filter-due-date")?$("#filter-due-date").addClass("filter-on"):$("#filter-due-date").removeClass("filter-on");h()}var l=null;jQuery(document).ready(function(){Kanboard.Exists("board")&&(g(),r(),b(),c())})}(); Kanboard.Calendar=function(){function a(a){$.ajax({cache:!1,url:$("#calendar").data("save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a.id,date_due:a.start.format()})})}function c(a){var b=$("#user-calendar");a=b.data("check-url");var c={start:b.fullCalendar("getView").start.format(),end:b.fullCalendar("getView").end.format(),user_id:b.data("user-id")},d;for(d in c)a+="&"+d+"="+c[d];$.getJSON(a,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource", a);b.fullCalendar("rerenderEvents")})}function b(a){var b=$("#calendar"),c=b.data("check-url"),d={start:b.fullCalendar("getView").start.format(),end:b.fullCalendar("getView").end.format()};jQuery.extend(d,a);for(var e in d)c+="&"+e+"="+d[e];$.getJSON(c,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource",a);b.fullCalendar("rerenderEvents")})}function d(){var a=Kanboard.GetStorageItem(f);if(""!==a){var a=JSON.parse(a),c;for(c in a)$("select[name="+c+"]").val(a[c])}b(a||{});$(".calendar-filter").change(e)} function e(){var a={};$(".calendar-filter").each(function(b,c){a[$(this).attr("name")]=$(this).val()});Kanboard.SetStorageItem(f,JSON.stringify(a));b(a)}var f="";jQuery(document).ready(function(){if(Kanboard.Exists("calendar")){f="calendar_filters_"+$("#calendar").data("project-id");var b=$("#calendar");b.data("translations");b.fullCalendar({lang:$("body").data("js-lang"),editable:!0,eventLimit:!0,defaultView:"agendaWeek",header:{left:"prev,next today",center:"title",right:"month,agendaWeek,agendaDay"}, diff --git a/assets/js/src/board.js b/assets/js/src/board.js index e4ba4ed5..45b43794 100644 --- a/assets/js/src/board.js +++ b/assets/js/src/board.js @@ -18,6 +18,60 @@ Kanboard.Board = (function() { }); } + // Collapse/Expand tasks + function stack_load_events() + { + $(".filter-expand-link").click(function(e) { + e.preventDefault(); + stack_expand(); + Kanboard.SetStorageItem(stack_key(), "expanded") + }); + + $(".filter-collapse-link").click(function(e) { + e.preventDefault(); + stack_collapse(); + Kanboard.SetStorageItem(stack_key(), "collapsed") + }); + + stack_show(); + } + + function stack_key() + { + var projectId = $('#board').data('project-id'); + return "board_stacking_" + projectId; + } + + function stack_collapse() + { + $(".filter-collapse").hide(); + $(".task-board-collapsed").show(); + + $(".filter-expand").show(); + $(".task-board-expanded").hide(); + } + + function stack_expand() + { + $(".filter-collapse").show(); + $(".task-board-collapsed").hide(); + + $(".filter-expand").hide(); + $(".task-board-expanded").show(); + } + + function stack_show() + { + var state = Kanboard.GetStorageItem(stack_key()) || "expanded"; + + if (state === "expanded") { + stack_expand(); + } + else { + stack_collapse(); + } + } + // Setup the board function board_load_events() { @@ -178,6 +232,7 @@ Kanboard.Board = (function() { Kanboard.InitAfterAjax(); board_load_events(); filter_apply(); + stack_show(); } }); } @@ -197,6 +252,7 @@ Kanboard.Board = (function() { board_unload_events(); board_load_events(); filter_apply(); + stack_show(); } } }); @@ -232,7 +288,7 @@ Kanboard.Board = (function() { item.style.opacity = "0.2"; } }); - + // Save filter settings Kanboard.SetStorageItem("board_filter_" + projectId + "_form-user_id", selectedUserId); Kanboard.SetStorageItem("board_filter_" + projectId + "_form-category_id", selectedCategoryId); @@ -251,17 +307,17 @@ Kanboard.Board = (function() { filter_apply(); e.preventDefault(); }); - + // Get and set filters from localStorage $("#form-user_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-user_id") || -1); $("#form-category_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-category_id") || -1); - + if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-due-date")) { $("#filter-due-date").addClass("filter-on"); } else { $("#filter-due-date").removeClass("filter-on"); } - + filter_apply(); } @@ -270,6 +326,7 @@ Kanboard.Board = (function() { if (Kanboard.Exists("board")) { board_load_events(); filter_load_events(); + stack_load_events(); keyboard_shortcuts(); } }); |