From 4ecfddb608f7f7b599fcfae03dbf7434af1d59fe Mon Sep 17 00:00:00 2001 From: gevorgmansuryan Date: Wed, 27 Nov 2024 03:29:38 +0400 Subject: [PATCH 1/4] Tasks Module Issues --- assets/Assets.php | 9 +++++++++ controllers/TaskController.php | 14 +++----------- resources/js/humhub.task.js | 15 +++++++++++++++ resources/js/humhub.task.list.js | 4 ++-- widgets/TaskContextMenu.php | 2 +- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/assets/Assets.php b/assets/Assets.php index a4739d28..1cde42e0 100644 --- a/assets/Assets.php +++ b/assets/Assets.php @@ -12,6 +12,7 @@ use humhub\components\assets\AssetBundle; use humhub\modules\tasks\controllers\ListController; use humhub\modules\tasks\controllers\SearchController; +use Yii; class Assets extends AssetBundle { @@ -49,6 +50,14 @@ public static function register($view) . '.task-overview #task-filter-nav .task-bottom-panel .filterInput[data-filter-type=checkbox] .fa.fa-check-square-o{border-color:var(--info);background:var(--info)}'); } + $view->registerJsConfig([ + 'task' => [ + 'text' => [ + 'success.delete' => Yii::t('base', 'Deleted'), + ], + ], + ]); + return parent::register($view); } } diff --git a/controllers/TaskController.php b/controllers/TaskController.php index 2c2a876f..d9ac08a5 100644 --- a/controllers/TaskController.php +++ b/controllers/TaskController.php @@ -73,7 +73,7 @@ public function actionEdit($id = null, $cal = false, $redirect = false, $listId $taskForm->createNew($this->contentContainer); } else { $taskForm = new TaskForm([ - 'task' => Task::find()->contentContainer($this->contentContainer)->where(['task.id' => $id])->one(), + 'task' => $this->getTaskById($id), 'cal' => $cal, 'redirect' => $redirect, 'wall' => $wall, @@ -162,11 +162,7 @@ public function actionTaskResponsiblePicker($keyword = '') public function actionView($id) { - $task = Task::find()->contentContainer($this->contentContainer)->where(['task.id' => $id])->one(); - - if (!$task) { - throw new HttpException(404); - } + $task = $this->getTaskById($id); if (!$task->content->canView()) { throw new HttpException(403); @@ -179,11 +175,7 @@ public function actionView($id) public function actionLoadAjaxTask($id) { - $task = Task::find()->contentContainer($this->contentContainer)->where(['task.id' => $id])->one(); - - if (!$task) { - throw new HttpException(404); - } + $task = $this->getTaskById($id); if (!$task->content->canView()) { throw new HttpException(403); diff --git a/resources/js/humhub.task.js b/resources/js/humhub.task.js index 805fc9e3..75fff63f 100644 --- a/resources/js/humhub.task.js +++ b/resources/js/humhub.task.js @@ -192,6 +192,20 @@ humhub.module('task', function (module, require, $) { }); }; + var deleteTaskFromContext = function(evt) { + var widget = Widget.closest(evt.$trigger); + widget.$.fadeOut('fast'); + + client.post(evt).then(function() { + event.trigger('task.afterDelete'); + $('#task-space-menu').find('a:first').click(); + module.log.success(module.text('success.delete')); + }).catch(function(e) { + widget.$.fadeIn('fast'); + module.log.error(e, true); + }); + }; + /** * @param evt */ @@ -255,6 +269,7 @@ humhub.module('task', function (module, require, $) { init: init, Form: Form, deleteTask: deleteTask, + deleteTaskFromContext: deleteTaskFromContext, changeState: changeState, extensionrequest:extensionrequest }); diff --git a/resources/js/humhub.task.list.js b/resources/js/humhub.task.list.js index d435fac9..8476fb4f 100644 --- a/resources/js/humhub.task.list.js +++ b/resources/js/humhub.task.list.js @@ -376,9 +376,9 @@ humhub.module('task.list', function (module, require, $) { that.$.find('.task-list-task-details').hide(); } - if (that.isCompleted()) { + if (that.isCompleted() && that.parent()) { that.parent().prependCompleted(that); - } else if(that.$.closest('.tasks-completed')) { + } else if(that.$.closest('.tasks-completed') && that.parent()) { that.parent().prependPending(that); } else { that.$.fadeIn(); diff --git a/widgets/TaskContextMenu.php b/widgets/TaskContextMenu.php index 6640d984..46b4288b 100644 --- a/widgets/TaskContextMenu.php +++ b/widgets/TaskContextMenu.php @@ -96,7 +96,7 @@ public function initControls() 'icon' => 'trash', 'sortOrder' => 300, 'htmlOptions' => [ - 'data-action-click' => 'ui.modal.post', + 'data-action-click' => 'task.deleteTaskFromContext', 'data-action-click-url' => TaskUrl::deleteTask($this->task), 'data-action-confirm-header' => Yii::t('TasksModule.base', 'Confirm task deletion'), 'data-action-confirm' => Yii::t('TasksModule.base', 'Do you really want to delete this task?'), From ccf15c97c8588ca6ac042dae89e6499ff440fe29 Mon Sep 17 00:00:00 2001 From: gevorgmansuryan Date: Tue, 26 Nov 2024 23:30:53 +0000 Subject: [PATCH 2/4] Autocommit PHP CS Fixer --- CalendarUtils.php | 1 + Events.php | 1 + controllers/ConfigContainerController.php | 1 + controllers/GlobalController.php | 1 + controllers/ListController.php | 1 + controllers/SearchController.php | 1 + controllers/rest/TaskListController.php | 1 + controllers/rest/TasksController.php | 1 + helpers/RestDefinitions.php | 1 + integration/calendar/TaskCalendar.php | 1 + integration/calendar/TaskCalendarQuery.php | 1 + jobs/SendReminder.php | 1 + models/Sortable.php | 1 + models/Task.php | 1 + models/checklist/TaskItem.php | 1 + models/forms/ConfigureContainerForm.php | 1 + models/forms/ItemDrop.php | 1 + models/forms/TaskFilter.php | 1 + models/lists/TaskList.php | 1 + models/lists/TaskListInterface.php | 1 + models/lists/TaskListSettings.php | 1 + models/scheduling/TaskReminder.php | 1 + models/scheduling/TaskScheduling.php | 1 + models/search/TaskPicker.php | 1 + models/user/TaskUser.php | 1 + tests/codeception/_bootstrap.php | 1 + tests/codeception/_support/AcceptanceTester.php | 1 + tests/codeception/_support/FunctionalTester.php | 1 + tests/codeception/_support/UnitTester.php | 1 + tests/codeception/acceptance/TaskListCest.php | 1 + tests/codeception/acceptance/_bootstrap.php | 1 + tests/codeception/api/_bootstrap.php | 1 + tests/codeception/functional/_bootstrap.php | 1 + tests/codeception/unit/TaskNotificationTest.php | 1 + tests/codeception/unit/TaskQueryTest.php | 1 + tests/codeception/unit/TaskSortTest.php | 1 + tests/codeception/unit/TaskStateTest.php | 1 + tests/codeception/unit/_bootstrap.php | 1 + tests/config/api.php | 1 + tests/config/common.php | 1 + tests/config/functional.php | 1 + tests/config/test.php | 1 + tests/config/unit.php | 1 + widgets/AddItemsInput.php | 1 + widgets/ContentTagDropDown.php | 1 + widgets/MyTasks.php | 1 + widgets/TaskBadge.php | 1 + widgets/TaskContextMenu.php | 1 + widgets/TaskDetails.php | 1 + widgets/TaskHeader.php | 1 + widgets/TaskIcon.php | 1 + widgets/TaskPercentageBar.php | 1 + widgets/TaskPicker.php | 1 + widgets/TaskSubMenu.php | 1 + widgets/checklist/TaskChecklist.php | 1 + widgets/checklist/TaskChecklistItem.php | 1 + widgets/lists/CompletedTaskListView.php | 1 + widgets/lists/TaskListItem.php | 1 + widgets/lists/TaskListWidget.php | 1 + widgets/search/CheckboxFilterInput.php | 1 + widgets/search/DateFilter.php | 1 + widgets/search/PickerFilterInput.php | 1 + widgets/search/TaskFilterNavigation.php | 1 + widgets/search/TaskSearchList.php | 1 + widgets/search/TaskSearchListEntry.php | 1 + widgets/search/TextFilterInput.php | 1 + 66 files changed, 66 insertions(+) diff --git a/CalendarUtils.php b/CalendarUtils.php index 5363c8a9..07ae0d81 100644 --- a/CalendarUtils.php +++ b/CalendarUtils.php @@ -1,4 +1,5 @@ Date: Wed, 27 Nov 2024 03:36:20 +0400 Subject: [PATCH 3/4] Tasks Module Issues --- docs/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 603e24c6..30b48a44 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,7 @@ Changelog - Enh #258: By default, enabled "Mobile" notification types for those enabled for "Web" - Enh #259: Replace theme variables with CSS variables - Enh #260: Use PHP CS Fixer +- Fix #263: Fixed deleted tasks visibility, reload after deletion, reload after state change 1.8.5 (March 14, 2024) ---------------------- From 02f8dd7eadd539df9daa41b5767975e61401ed7f Mon Sep 17 00:00:00 2001 From: gevorgmansuryan Date: Sat, 30 Nov 2024 01:31:47 +0400 Subject: [PATCH 4/4] Tasks Module Issues --- widgets/checklist/views/taskChecklistItem.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/widgets/checklist/views/taskChecklistItem.php b/widgets/checklist/views/taskChecklistItem.php index 6800e441..874a8e0e 100644 --- a/widgets/checklist/views/taskChecklistItem.php +++ b/widgets/checklist/views/taskChecklistItem.php @@ -25,7 +25,15 @@
- id . ']', $item->completed, ['label' => $item->title, 'itemId' => $item->id, 'data-action-change' => 'check', 'disabled' => $disabled]); ?> + id . ']', $item->completed, [ + 'label' => $item->title, + 'itemId' => $item->id, + 'data-action-change' => 'check', + 'disabled' => $disabled, + 'labelOptions' => [ + 'class' => $item->completed ? 'item-finished' : '', + ] + ]); ?>