Skip to content

Commit

Permalink
Merge pull request #46 from BlueTeck/filter
Browse files Browse the repository at this point in the history
add group filter dropdown
  • Loading branch information
creecros authored Sep 6, 2019
2 parents 9afc517 + e47eba4 commit 4544ae5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,16 @@ public function initialize()
$this->template->setTemplateOverride('task_modification/show', 'group_assign:task_modification/show');

//Board
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/group');
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/multi');
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/group');
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/multi');
$groupmodel = $this->projectGroupRoleModel;
$this->template->hook->attachCallable('template:app:filters-helper:after', 'group_assign:board/filter', function($array = array()) use ($groupmodel) {
if(!empty($array) && $array['id'] >= 1){
return ['grouplist' => array_column($groupmodel->getGroups($array['id']), 'name')];
} else {
return ['grouplist' => array()];
}
});

//Filter
$this->container->extend('taskLexer', function($taskLexer, $c) {
Expand Down
12 changes: 12 additions & 0 deletions Template/board/filter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php if (isset($grouplist) && !empty($grouplist)) : ?>
</div>
<div class="input-addon-item">
<div class="dropdown">
<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>
<ul>
<?php foreach ($grouplist as $group) : ?>
<li><a href="#" class="filter-helper" data-unique-filter='allassignees:"<?= $this->text->e($group) ?>"'><?= $this->text->e($group) ?></a></li>
<?php endforeach ?>
</ul>
</div>
<?php endif ?>

0 comments on commit 4544ae5

Please sign in to comment.