From 6c4434ae37a4f950479828b411ce6b007cf203c2 Mon Sep 17 00:00:00 2001 From: Minh Tho DUONG Date: Tue, 14 May 2024 13:29:13 +1000 Subject: [PATCH 1/2] refactor: migrate the confirmation-model component --- .../confirmation-modal.coffee | 35 ---------------- ...html => confirmation-modal.component.html} | 6 +-- ...scss => confirmation-modal.component.scss} | 4 +- .../confirmation-modal.component.ts | 41 +++++++++++++++++++ .../confirmation-modal.service.ts | 19 +++++++++ src/app/common/modals/modals.coffee | 1 - src/app/doubtfire-angular.module.ts | 2 + src/app/doubtfire-angularjs.module.ts | 3 +- 8 files changed, 69 insertions(+), 42 deletions(-) delete mode 100644 src/app/common/modals/confirmation-modal/confirmation-modal.coffee rename src/app/common/modals/confirmation-modal/{confirmation-modal.tpl.html => confirmation-modal.component.html} (74%) rename src/app/common/modals/confirmation-modal/{confirmation-modal.scss => confirmation-modal.component.scss} (57%) create mode 100644 src/app/common/modals/confirmation-modal/confirmation-modal.component.ts create mode 100644 src/app/common/modals/confirmation-modal/confirmation-modal.service.ts diff --git a/src/app/common/modals/confirmation-modal/confirmation-modal.coffee b/src/app/common/modals/confirmation-modal/confirmation-modal.coffee deleted file mode 100644 index c7999098c..000000000 --- a/src/app/common/modals/confirmation-modal/confirmation-modal.coffee +++ /dev/null @@ -1,35 +0,0 @@ -angular.module("doubtfire.common.modals.confirmation-modal", []) - -.factory("ConfirmationModal", ($modal) -> - ConfirmationModal = {} - - # - # Show a modal asking the user to confirm their indicated action. - # - ConfirmationModal.show = (title, message, action) -> - modalInstance = $modal.open - templateUrl: 'common/modals/confirmation-modal/confirmation-modal.tpl.html' - controller: 'ConfirmationModalCtrl' - resolve: - title: -> title - message: -> message - action: -> action - - ConfirmationModal -) - -# -# Controller for confirmation modal -# -.controller('ConfirmationModalCtrl', ($scope, $modalInstance, title, message, action, alertService) -> - $scope.title = title - $scope.message = message - - $scope.confirmAction = -> - action() - $modalInstance.dismiss() - - $scope.cancelAction = -> - alertService.message "#{title} action cancelled", 3000 - $modalInstance.dismiss() -) diff --git a/src/app/common/modals/confirmation-modal/confirmation-modal.tpl.html b/src/app/common/modals/confirmation-modal/confirmation-modal.component.html similarity index 74% rename from src/app/common/modals/confirmation-modal/confirmation-modal.tpl.html rename to src/app/common/modals/confirmation-modal/confirmation-modal.component.html index 4bd87f686..ec66dcf72 100644 --- a/src/app/common/modals/confirmation-modal/confirmation-modal.tpl.html +++ b/src/app/common/modals/confirmation-modal/confirmation-modal.component.html @@ -6,15 +6,15 @@ -