Files
OrganonTweaks/Plugin.php

76 lines
2.4 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',
));
}
}
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.0.0';
}
public function getPluginHomepage()
{
return 'https://code.beco.cc/beco/OrganonTweaks';
}
public function getCompatibleVersion()
{
return '>=1.2.0';
}
}