From f17ae44952eb45554faf032ae9f34a35a5814619 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 11 Jan 2023 11:50:12 +0100 Subject: [PATCH] fix(dossier): disable buttons when selection is canceled --- app/components/dossiers/batch_operation_component.rb | 2 +- app/javascript/controllers/batch_operation_controller.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/components/dossiers/batch_operation_component.rb b/app/components/dossiers/batch_operation_component.rb index 596986bed..51a439b46 100644 --- a/app/components/dossiers/batch_operation_component.rb +++ b/app/components/dossiers/batch_operation_component.rb @@ -13,7 +13,7 @@ class Dossiers::BatchOperationComponent < ApplicationComponent def operations_for_dossier(dossier) case dossier.state when Dossier.states.fetch(:en_construction) - [BatchOperation.operations.fetch(:passer_en_instruction)] + [BatchOperation.operations.fetch(:passer_en_instruction), BatchOperation.operations.fetch(:follow)] when Dossier.states.fetch(:en_instruction) [BatchOperation.operations.fetch(:accepter)] when Dossier.states.fetch(:accepte), Dossier.states.fetch(:refuse), Dossier.states.fetch(:sans_suite) diff --git a/app/javascript/controllers/batch_operation_controller.ts b/app/javascript/controllers/batch_operation_controller.ts index 786da172d..0b01193ee 100644 --- a/app/javascript/controllers/batch_operation_controller.ts +++ b/app/javascript/controllers/batch_operation_controller.ts @@ -40,8 +40,11 @@ export class BatchOperationController extends ApplicationController { disable(this.menuTarget); } } - } else if (this.hasMenuTarget) { - disable(this.menuTarget); + } else { + if (this.hasMenuTarget) { + disable(this.menuTarget); + } + buttons.forEach((button) => switchButton(button, false)); } } }