Skip to content

Commit 4544ae5

Browse files
authored
Merge pull request #46 from BlueTeck/filter
add group filter dropdown
2 parents 9afc517 + e47eba4 commit 4544ae5

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

Plugin.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,16 @@ public function initialize()
108108
$this->template->setTemplateOverride('task_modification/show', 'group_assign:task_modification/show');
109109

110110
//Board
111-
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/group');
112-
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/multi');
111+
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/group');
112+
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/multi');
113+
$groupmodel = $this->projectGroupRoleModel;
114+
$this->template->hook->attachCallable('template:app:filters-helper:after', 'group_assign:board/filter', function($array = array()) use ($groupmodel) {
115+
if(!empty($array) && $array['id'] >= 1){
116+
return ['grouplist' => array_column($groupmodel->getGroups($array['id']), 'name')];
117+
} else {
118+
return ['grouplist' => array()];
119+
}
120+
});
113121

114122
//Filter
115123
$this->container->extend('taskLexer', function($taskLexer, $c) {

Template/board/filter.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php if (isset($grouplist) && !empty($grouplist)) : ?>
2+
</div>
3+
<div class="input-addon-item">
4+
<div class="dropdown">
5+
<a href="#" class="dropdown-menu dropdown-menu-link-icon" title="<?= t('Group filters') ?>"><i class="fa fa-users fa-fw"></i><i class="fa fa-caret-down"></i></a>
6+
<ul>
7+
<?php foreach ($grouplist as $group) : ?>
8+
<li><a href="#" class="filter-helper" data-unique-filter='allassignees:"<?= $this->text->e($group) ?>"'><?= $this->text->e($group) ?></a></li>
9+
<?php endforeach ?>
10+
</ul>
11+
</div>
12+
<?php endif ?>

0 commit comments

Comments
 (0)