target dropdown shows all columns; italicize current column (v1.9.1)
This commit is contained in:
@@ -78,6 +78,35 @@
|
||||
if (invert) { invert.disabled = (trigger.value === "any"); }
|
||||
}
|
||||
|
||||
// Move-mode makes copies moot, so grey out "Link copies to the template" while it is checked
|
||||
// (disabled -> it won't post, so the saved value is 0).
|
||||
function applyMove() {
|
||||
var move = document.querySelector('input[name="recoreco_move"]');
|
||||
var link = document.querySelector('input[name="recoreco_link_copies"]');
|
||||
if (!move || !link) { return; }
|
||||
|
||||
link.disabled = move.checked;
|
||||
var label = link.closest("label");
|
||||
if (label) { label.style.opacity = move.checked ? "0.5" : ""; }
|
||||
}
|
||||
|
||||
// Italicize the card's current column in the target/trigger dropdowns, so you can see where it
|
||||
// sits right now. (<option> styling is honored by Chrome/Firefox; Safari may ignore it.)
|
||||
function applyCurrentItalic() {
|
||||
var form = document.querySelector('form[data-recoreco-current]');
|
||||
if (!form) { return; }
|
||||
|
||||
var current = form.getAttribute("data-recoreco-current");
|
||||
var selects = form.querySelectorAll('select[name="recoreco_target_column"], select[name="recoreco_trigger_column"]');
|
||||
for (var s = 0; s < selects.length; s++) {
|
||||
for (var i = 0; i < selects[s].options.length; i++) {
|
||||
if (selects[s].options[i].value === current) {
|
||||
selects[s].options[i].style.fontStyle = "italic";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("change", function (e) {
|
||||
if (e.target && e.target.name === "recoreco_frequency") {
|
||||
apply(e.target);
|
||||
@@ -88,6 +117,9 @@
|
||||
if (e.target && (e.target.name === "recoreco_target_column" || e.target.name === "recoreco_trigger_column")) {
|
||||
applyTrigger();
|
||||
}
|
||||
if (e.target && e.target.name === "recoreco_move") {
|
||||
applyMove();
|
||||
}
|
||||
});
|
||||
|
||||
if (window.MutationObserver) {
|
||||
@@ -97,6 +129,8 @@
|
||||
select.setAttribute("data-recoreco-init", "1");
|
||||
apply(select);
|
||||
applyTrigger();
|
||||
applyMove();
|
||||
applyCurrentItalic();
|
||||
}
|
||||
}).observe(document.body, { childList: true, subtree: true });
|
||||
}
|
||||
|
||||
@@ -120,13 +120,13 @@ class RecurrenceController extends BaseController
|
||||
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
|
||||
}
|
||||
|
||||
// Columns the copy can land in: every column except the template's own (the copy must move).
|
||||
// Target columns: ALL of the project's columns. This used to exclude the card's own column (a
|
||||
// duplicate copy "must move"), but move-mode legitimately rests the card IN the target, so the
|
||||
// target must be any column -- otherwise a moved card's own target vanishes from the dropdown and
|
||||
// a re-save would silently reset it. `target != trigger` is enforced in the modal instead.
|
||||
private function targetColumns(array $task)
|
||||
{
|
||||
$columns = $this->columnModel->getList($task['project_id']);
|
||||
unset($columns[$task['column_id']]);
|
||||
|
||||
return $columns;
|
||||
return $this->columnModel->getList($task['project_id']);
|
||||
}
|
||||
|
||||
// A stored/posted target, if still a valid non-current column; otherwise the first one (or 0).
|
||||
|
||||
@@ -62,7 +62,7 @@ class Plugin extends Base
|
||||
|
||||
public function getPluginVersion()
|
||||
{
|
||||
return '1.9.0';
|
||||
return '1.9.1';
|
||||
}
|
||||
|
||||
public function getPluginHomepage()
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<p class="alert alert-info"><?= t('Add a target column first.') ?></p>
|
||||
<?php endif ?>
|
||||
|
||||
<form method="post" action="<?= $this->url->href('RecurrenceController', 'save', array('plugin' => 'RecoReco', 'task_id' => $task['id'])) ?>" autocomplete="off">
|
||||
<form method="post" action="<?= $this->url->href('RecurrenceController', 'save', array('plugin' => 'RecoReco', 'task_id' => $task['id'])) ?>" autocomplete="off" data-recoreco-current="<?= (int) $task['column_id'] ?>">
|
||||
<?= $this->form->csrf() ?>
|
||||
|
||||
<?= $this->form->label(t('Make recurring'), 'recoreco_enabled') ?>
|
||||
|
||||
Reference in New Issue
Block a user