v1.6 duemonth/aroundmonth search keywords + auto-added month filter bookmarks

This commit is contained in:
2026-07-09 06:49:15 -03:00
parent bc266ff969
commit 4d7f88aa94
8 changed files with 211 additions and 41 deletions

View File

@@ -58,11 +58,27 @@ class Plugin extends Base
));
}
// Tweak: keep a shared "Show all tasks" custom filter (empty query -> open + closed) on every
// board as a one-click "clear the filter". Ensured lazily when a project header renders, so
// it covers old and new boards. The config toggle bulk-adds/removes them (ConfigController).
if ((int) $this->configModel->get('organon_tweaks_show_all_filter', 1) === 1) {
$this->template->hook->attach('template:project:header:before', 'organonTweaks:project_header/show_all_filter');
// Auto-managed shared custom filters (v1.5 "Show all tasks", v1.6 month filters). Ensured
// lazily whenever a project header renders (covers old + new boards); each group is gated by
// its own config toggle inside OrganonProjectHelper::ensureBoardFilters(). The toggles also
// bulk add/remove the filters (ConfigController).
$showAllFilters = (int) $this->configModel->get('organon_tweaks_show_all_filter', 1) === 1;
$monthFilters = (int) $this->configModel->get('organon_tweaks_month_filters', 1) === 1;
if ($showAllFilters || $monthFilters) {
$this->template->hook->attach('template:project:header:before', 'organonTweaks:project_header/board_filters');
}
// Custom board-search keywords, registered into the task lexer by extending its factory
// service (Pimple preserves factory status on extend, so the lexer stays per-request fresh).
// `duemonth:VALUE` = a whole calendar month; `aroundmonth:VALUE` = that month padded by 10
// days on each side. Always available to type, independent of the bookmark toggles above.
// Guarded so a future Kanboard service rename no-ops (keyword absent) instead of breaking.
if (isset($this->container['taskLexer'])) {
$this->container->extend('taskLexer', function ($builder, $c) {
return $builder
->withFilter((new \Kanboard\Plugin\OrganonTweaks\Filter\TaskMonthRangeFilter())->setAttribute('duemonth')->setPadDays(0))
->withFilter((new \Kanboard\Plugin\OrganonTweaks\Filter\TaskMonthRangeFilter())->setAttribute('aroundmonth')->setPadDays(10));
});
}
}
@@ -90,7 +106,7 @@ class Plugin extends Base
public function getPluginVersion()
{
return '1.5.0';
return '1.6.0';
}
public function getPluginHomepage()