75 lines
2.4 KiB
PHP
75 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace Kanboard\Plugin\ShrinkVertically;
|
|
|
|
use Kanboard\Core\Plugin\Base;
|
|
|
|
class Plugin extends Base
|
|
{
|
|
public function initialize()
|
|
{
|
|
// Inject a small CSS override that reduces the height of vertically
|
|
// collapsed board columns so the horizontal scrollbar stays visible.
|
|
$this->hook->on('template:layout:css', array(
|
|
'template' => 'plugins/ShrinkVertically/Asset/css/shrink-vertically.css',
|
|
));
|
|
|
|
// Inject the configured pixel offset as a CSS variable in the page head.
|
|
$this->template->hook->attach('template:layout:head', 'shrinkVertically:layout/variable');
|
|
|
|
// Append a "+" to the two vertical-collapse menu labels so it is visible
|
|
// that the behaviour is modified by this plugin.
|
|
$this->hook->on('template:layout:js', array(
|
|
'template' => 'plugins/ShrinkVertically/Asset/js/shrink-vertically.js',
|
|
));
|
|
|
|
// Add a "Shrink Vertically" entry to the Settings sidebar.
|
|
$this->template->hook->attach('template:config:sidebar', 'shrinkVertically:config/sidebar');
|
|
|
|
// Optional: a second, mirrored horizontal scrollbar above the board columns.
|
|
if ((int) $this->configModel->get('shrink_vertically_top_scrollbar', 1) === 1) {
|
|
$this->hook->on('template:layout:js', array(
|
|
'template' => 'plugins/ShrinkVertically/Asset/js/top-scrollbar.js',
|
|
));
|
|
}
|
|
|
|
// Optional: auto-adjust the collapsed column height to the screen (measured live on the
|
|
// board), overriding the static pixel offset so the vertical scrollbar is not needed.
|
|
if ((int) $this->configModel->get('shrink_vertically_auto', 0) === 1) {
|
|
$this->hook->on('template:layout:js', array(
|
|
'template' => 'plugins/ShrinkVertically/Asset/js/auto-adjust.js',
|
|
));
|
|
}
|
|
}
|
|
|
|
public function getPluginName()
|
|
{
|
|
return 'ShrinkVertically';
|
|
}
|
|
|
|
public function getPluginDescription()
|
|
{
|
|
return t('Shrink vertically-collapsed board columns so the horizontal scrollbar stays visible.');
|
|
}
|
|
|
|
public function getPluginAuthor()
|
|
{
|
|
return 'Ruben (drbeco)';
|
|
}
|
|
|
|
public function getPluginVersion()
|
|
{
|
|
return '1.6.4';
|
|
}
|
|
|
|
public function getPluginHomepage()
|
|
{
|
|
return 'https://code.beco.cc/beco/shrink-vertically';
|
|
}
|
|
|
|
public function getCompatibleVersion()
|
|
{
|
|
return '>=1.2.0';
|
|
}
|
|
}
|