diff --git a/Asset/js/save-close.js b/Asset/js/save-close.js deleted file mode 100644 index 12fa30a..0000000 --- a/Asset/js/save-close.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * OrganonTweaks -- the "Save & Close" button on the task edit form. It is a plain type=button (so it - * never becomes the Enter default -- Enter still triggers the core Save), and on click it repoints - * the form to the plugin's TaskSaveCloseController and lets Kanboard's own modal submit it. Kanboard - * keeps ownership of the POST, CSRF, error re-render, and the X-Ajax-Redirect navigation; we only - * change the destination, so the controller redirects to the board instead of the card view. - */ -(function () { - "use strict"; - - document.addEventListener("click", function (e) { - if (!e.target || !e.target.closest) { - return; - } - - var btn = e.target.closest("[data-organon-save-close]"); - if (!btn) { - return; - } - - e.preventDefault(); - - var form = btn.closest("form"); - var url = btn.getAttribute("data-url"); - if (!form || !url) { - return; - } - - form.setAttribute("action", url); - - if (window.KB && KB.modal && KB.modal.isOpen && KB.modal.isOpen() && KB.modal.submitForm) { - KB.modal.submitForm(); - } else if (form.requestSubmit) { - form.requestSubmit(); - } else { - form.submit(); - } - }, false); -})(); diff --git a/Controller/ConfigController.php b/Controller/ConfigController.php index 876f31d..7ca854e 100644 --- a/Controller/ConfigController.php +++ b/Controller/ConfigController.php @@ -24,7 +24,6 @@ class ConfigController extends BaseController 'organon_tweaks_recurring_filters' => (int) $this->configModel->get('organon_tweaks_recurring_filters', 1), 'organon_tweaks_shortcut_labels' => (int) $this->configModel->get('organon_tweaks_shortcut_labels', 1), 'organon_tweaks_title_click_edit' => (int) $this->configModel->get('organon_tweaks_title_click_edit', 1), - 'organon_tweaks_save_close_button' => (int) $this->configModel->get('organon_tweaks_save_close_button', 1), ), 'errors' => array(), ))); @@ -44,7 +43,6 @@ class ConfigController extends BaseController $recurringFilters = isset($values['organon_tweaks_recurring_filters']) ? 1 : 0; $shortcutLabels = isset($values['organon_tweaks_shortcut_labels']) ? 1 : 0; $titleClickEdit = isset($values['organon_tweaks_title_click_edit']) ? 1 : 0; - $saveCloseButton = isset($values['organon_tweaks_save_close_button']) ? 1 : 0; if ($this->configModel->save(array( 'organon_tweaks_always_comment_icon' => $alwaysCommentIcon, @@ -57,7 +55,6 @@ class ConfigController extends BaseController 'organon_tweaks_recurring_filters' => $recurringFilters, 'organon_tweaks_shortcut_labels' => $shortcutLabels, 'organon_tweaks_title_click_edit' => $titleClickEdit, - 'organon_tweaks_save_close_button' => $saveCloseButton, ))) { $this->flash->success(t('Settings saved successfully.')); } else { diff --git a/Controller/TaskSaveCloseController.php b/Controller/TaskSaveCloseController.php deleted file mode 100644 index a402079..0000000 --- a/Controller/TaskSaveCloseController.php +++ /dev/null @@ -1,33 +0,0 @@ -getTask(); - $values = $this->request->getValues(); - $values['id'] = $task['id']; - $values['project_id'] = $task['project_id']; - - list($valid, $errors) = $this->taskValidator->validateModification($values); - - if ($valid && $this->updateTask($task, $values, $errors)) { - $this->flash->success(t('Task updated successfully.')); - $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $task['project_id'])), true); - } else { - $this->flash->failure(t('Unable to update your task.')); - $this->edit($values, $errors); - } - } -} diff --git a/Plugin.php b/Plugin.php index ac94715..67c783d 100644 --- a/Plugin.php +++ b/Plugin.php @@ -77,17 +77,6 @@ class Plugin extends Base $this->template->hook->attach('template:board:private:task:before-title', 'organonTweaks:board/title_edit'); } - // Tweak: a "Save & Close" button on the task edit form that saves and returns to the board - // (core only reopens the card view). The button posts to a small plugin controller that - // reuses core's update and changes only the redirect; the JS repoints the form action, so - // Kanboard's modal still owns the submit, CSRF, and error re-render. - if ((int) $this->configModel->get('organon_tweaks_save_close_button', 1) === 1) { - $this->template->hook->attach('template:task:form:bottom-before-buttons', 'organonTweaks:task_form/save_close_button'); - $this->hook->on('template:layout:js', array( - 'template' => 'plugins/OrganonTweaks/Asset/js/save-close.js', - )); - } - // Auto-managed shared custom filters (v1.5 "Show all tasks", v1.6 month filters, v1.7 // recurring filters). Ensured lazily whenever a project header renders (covers old + new // boards); each group is gated by its own config toggle inside @@ -139,7 +128,7 @@ class Plugin extends Base public function getPluginVersion() { - return '1.8.0'; + return '1.8.1'; } public function getPluginHomepage() diff --git a/Template/config/show.php b/Template/config/show.php index 5e66f55..0dd89d6 100644 --- a/Template/config/show.php +++ b/Template/config/show.php @@ -57,9 +57,6 @@ form->checkbox('organon_tweaks_title_click_edit', t('Clicking a task title opens the edit form'), 1, isset($values['organon_tweaks_title_click_edit']) && $values['organon_tweaks_title_click_edit'] == 1) ?>

- - form->checkbox('organon_tweaks_save_close_button', t('Add a "Save & Close" button to the task edit form'), 1, isset($values['organon_tweaks_save_close_button']) && $values['organon_tweaks_save_close_button'] == 1) ?> -

diff --git a/Template/task_form/save_close_button.php b/Template/task_form/save_close_button.php deleted file mode 100644 index b5a9ed3..0000000 --- a/Template/task_form/save_close_button.php +++ /dev/null @@ -1,8 +0,0 @@ - - 0): ?> - - diff --git a/VERSION b/VERSION index 1439ad4..47a04bd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -OrganonTweaks v1.8 +OrganonTweaks v1.8.1