92 lines
3.3 KiB
PHP
92 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace Kanboard\Plugin\OrganonTweaks;
|
|
|
|
use Kanboard\Core\Plugin\Base;
|
|
|
|
class Plugin extends Base
|
|
{
|
|
public function initialize()
|
|
{
|
|
// "Remove this Column" entry in the board column header dropdown. The only
|
|
// column hook renders outside the native menu <ul>, so the item is rendered
|
|
// hidden and relocate.js moves it into the menu (like BulkMoveTasks).
|
|
$this->template->hook->attach('template:board:column:dropdown', 'organonTweaks:board/column_dropdown');
|
|
|
|
$this->hook->on('template:layout:js', array(
|
|
'template' => 'plugins/OrganonTweaks/Asset/js/relocate.js',
|
|
));
|
|
|
|
// Settings page for the plugin's tweaks.
|
|
$this->template->hook->attach('template:config:sidebar', 'organonTweaks:config/sidebar');
|
|
|
|
// Tweak: always show a comment icon on board cards. When a card has no comments
|
|
// yet, add a bubble "+" that opens the same comment modal (add the first comment
|
|
// straight from the board). Cards with comments already show the native count.
|
|
if ((int) $this->configModel->get('organon_tweaks_always_comment_icon', 1) === 1) {
|
|
$this->template->hook->attach('template:board:task:icons', 'organonTweaks:board/task_comment_icon');
|
|
}
|
|
|
|
// Tweak: keep the board horizontal scroll position across refreshes (Kanboard
|
|
// rebuilds #board-container on card drop / polling, resetting scrollLeft to 0).
|
|
if ((int) $this->configModel->get('organon_tweaks_keep_scroll', 1) === 1) {
|
|
$this->hook->on('template:layout:js', array(
|
|
'template' => 'plugins/OrganonTweaks/Asset/js/keep-scroll.js',
|
|
));
|
|
}
|
|
|
|
// Tweak: only open a card on a quick click (a press held > 100ms is a drag, so the
|
|
// trailing click is swallowed and the card does not open).
|
|
if ((int) $this->configModel->get('organon_tweaks_quick_click_only', 1) === 1) {
|
|
$this->hook->on('template:layout:js', array(
|
|
'template' => 'plugins/OrganonTweaks/Asset/js/click-guard.js',
|
|
));
|
|
}
|
|
|
|
// Tweak: enhance the native "Edit recurrence" dialog (Yes/No radios + a [+7] button
|
|
// on the factor). No template hook there, so it is done in JS.
|
|
if ((int) $this->configModel->get('organon_tweaks_enhance_recurrence', 1) === 1) {
|
|
$this->hook->on('template:layout:js', array(
|
|
'template' => 'plugins/OrganonTweaks/Asset/js/enhance-recurrence.js',
|
|
));
|
|
}
|
|
}
|
|
|
|
public function getHelpers()
|
|
{
|
|
return array(
|
|
'Plugin\OrganonTweaks\Helper' => array('OrganonColumnHelper'),
|
|
);
|
|
}
|
|
|
|
public function getPluginName()
|
|
{
|
|
return 'OrganonTweaks';
|
|
}
|
|
|
|
public function getPluginDescription()
|
|
{
|
|
return t('Umbrella plugin for small Kanboard tweaks: remove an empty board column, always show the card comment icon, and more.');
|
|
}
|
|
|
|
public function getPluginAuthor()
|
|
{
|
|
return 'Ruben (drbeco)';
|
|
}
|
|
|
|
public function getPluginVersion()
|
|
{
|
|
return '1.3.0';
|
|
}
|
|
|
|
public function getPluginHomepage()
|
|
{
|
|
return 'https://code.beco.cc/beco/OrganonTweaks';
|
|
}
|
|
|
|
public function getCompatibleVersion()
|
|
{
|
|
return '>=1.2.0';
|
|
}
|
|
}
|