Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 00e404dfed | |||
| 865f382b6d | |||
| d66e7a7df4 | |||
| 2cb5df8e1c |
62
Asset/js/relocate.js
Normal file
62
Asset/js/relocate.js
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* BulkMoveTasks -- place the "Move tasks in bulk" entry inside the native column menu.
|
||||||
|
*
|
||||||
|
* Kanboard only exposes the template:board:column:dropdown hook AFTER the column menu
|
||||||
|
* <ul>, and its dropdown JS clones just that <ul> when the menu opens. So the hook item
|
||||||
|
* cannot reach the menu on its own. The column_dropdown.php template renders the item
|
||||||
|
* hidden next to the menu; this script moves each such item into that column's real <ul>
|
||||||
|
* so it appears alongside "Hide this column", "Create tasks in bulk", etc.
|
||||||
|
*
|
||||||
|
* It re-runs when the board is redrawn (AJAX polling / drag-and-drop refresh).
|
||||||
|
*/
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function relocate() {
|
||||||
|
var items = document.querySelectorAll(".bulkmovetasks-menu-item");
|
||||||
|
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
var li = items[i];
|
||||||
|
|
||||||
|
// Already moved into a menu list: just make sure it is visible.
|
||||||
|
if (li.closest("ul")) {
|
||||||
|
li.style.display = "";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The hook renders the item as a child of the column's dropdown wrapper;
|
||||||
|
// its first <ul> is the native menu.
|
||||||
|
var menu = li.parentNode ? li.parentNode.querySelector("ul") : null;
|
||||||
|
|
||||||
|
if (menu) {
|
||||||
|
menu.appendChild(li);
|
||||||
|
li.style.display = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
var container = document.getElementById("board-container");
|
||||||
|
|
||||||
|
if (!container) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
relocate();
|
||||||
|
|
||||||
|
// BoardDragAndDrop.refresh() does $("#board-container").replaceWith(data) on every
|
||||||
|
// drag-and-drop and poll refresh, so an observer bound to #board-container would be
|
||||||
|
// left watching a detached node and never fire again (the entry vanishes until F5).
|
||||||
|
// Observe the stable parent instead: it survives the swap, and its childList mutation
|
||||||
|
// fires exactly when the container is replaced, so relocate() re-runs on the new DOM.
|
||||||
|
if (window.MutationObserver && container.parentNode) {
|
||||||
|
new MutationObserver(relocate).observe(container.parentNode, { childList: true, subtree: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === "loading") {
|
||||||
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
|
} else {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
})();
|
||||||
11
Plugin.php
11
Plugin.php
@@ -8,9 +8,14 @@ class Plugin extends Base
|
|||||||
{
|
{
|
||||||
public function initialize()
|
public function initialize()
|
||||||
{
|
{
|
||||||
// Add a "Move all tasks to another column" entry to the board column
|
// Render the "Move tasks in bulk" entry. The only column hook sits outside the
|
||||||
// header dropdown. The hook passes the current $column and $swimlane.
|
// native menu <ul>, so column_dropdown.php renders it hidden and relocate.js
|
||||||
|
// moves it into the menu (passes the current $column and $swimlane).
|
||||||
$this->template->hook->attach('template:board:column:dropdown', 'bulkMoveTasks:board/column_dropdown');
|
$this->template->hook->attach('template:board:column:dropdown', 'bulkMoveTasks:board/column_dropdown');
|
||||||
|
|
||||||
|
$this->hook->on('template:layout:js', array(
|
||||||
|
'template' => 'plugins/BulkMoveTasks/Asset/js/relocate.js',
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPluginName()
|
public function getPluginName()
|
||||||
@@ -30,7 +35,7 @@ class Plugin extends Base
|
|||||||
|
|
||||||
public function getPluginVersion()
|
public function getPluginVersion()
|
||||||
{
|
{
|
||||||
return '0.2.0';
|
return '1.0.2';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPluginHomepage()
|
public function getPluginHomepage()
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -36,3 +36,19 @@ the folder name). No build step and no database migration.
|
|||||||
## License
|
## License
|
||||||
|
|
||||||
AGPL-3.0. See LICENSE.
|
AGPL-3.0. See LICENSE.
|
||||||
|
|
||||||
|
## More Kanboard plugins by Ruben (drbeco)
|
||||||
|
|
||||||
|
All free and AGPL-3.0, at [code.beco.cc](https://code.beco.cc/beco):
|
||||||
|
|
||||||
|
- **[RecoReco](https://code.beco.cc/beco/RecoReco)** -- calendar-scheduled recurring cards (yearly,
|
||||||
|
monthly, weekly, daily), driven by the card due date.
|
||||||
|
- **[FinanceBuddy](https://code.beco.cc/beco/FinanceBuddy)** -- attach a money value (debit/credit
|
||||||
|
and installments) to cards, shown on the card and totalled per column.
|
||||||
|
- **[OrganonTweaks](https://code.beco.cc/beco/OrganonTweaks)** -- an umbrella of small
|
||||||
|
quality-of-life board tweaks: remove an empty column, always show the comment icon, emphasize due
|
||||||
|
dates, extra search keywords and shared board filters, and more.
|
||||||
|
- **[ShrinkVertically](https://code.beco.cc/beco/ShrinkVertically)** -- shrink vertically-collapsed
|
||||||
|
board columns so the horizontal scrollbar stays within reach.
|
||||||
|
- **[TweakDrag](https://code.beco.cc/beco/TweakDrag)** -- board drag and touch niceties:
|
||||||
|
drag-to-scroll, a wider column gap, and smoother card dragging.
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<?php if ($column['nb_tasks'] > 0 && $this->user->hasProjectAccess('TaskModificationController', 'update', $column['project_id'])): ?>
|
<?php if ($column['nb_tasks'] > 0 && $this->user->hasProjectAccess('TaskModificationController', 'update', $column['project_id'])): ?>
|
||||||
<li>
|
<?php /* Rendered here (outside the menu <ul>) by the only available hook, then moved
|
||||||
<?= $this->modal->medium('arrows-h', t('Move all tasks to another column'), 'BulkMoveController', 'show', array(
|
into the column's real dropdown <ul> by Asset/js/relocate.js so it sits next
|
||||||
|
to the native entries. Hidden until relocated to avoid a flash in the header. */ ?>
|
||||||
|
<li class="bulkmovetasks-menu-item" style="display: none;">
|
||||||
|
<?= $this->modal->medium('arrows-h', t('Move tasks in bulk'), 'BulkMoveController', 'show', array(
|
||||||
'plugin' => 'BulkMoveTasks',
|
'plugin' => 'BulkMoveTasks',
|
||||||
'project_id' => $column['project_id'],
|
'project_id' => $column['project_id'],
|
||||||
'column_id' => $column['id'],
|
'column_id' => $column['id'],
|
||||||
|
|||||||
Reference in New Issue
Block a user