From e761b02252585fd4b2ead0616e3af412fde38d5e Mon Sep 17 00:00:00 2001 From: Katherine Fleming <2205659+kflemin@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:45:09 -0700 Subject: [PATCH] AH - Fix label creation UI (#4510) * fix add label modal * remove duplicate ngif --- .../js/controllers/update_item_labels_modal_controller.js | 2 +- seed/static/seed/js/services/simple_modal_service.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/seed/static/seed/js/controllers/update_item_labels_modal_controller.js b/seed/static/seed/js/controllers/update_item_labels_modal_controller.js index ed0d5717e0..c2847aa40b 100644 --- a/seed/static/seed/js/controllers/update_item_labels_modal_controller.js +++ b/seed/static/seed/js/controllers/update_item_labels_modal_controller.js @@ -60,7 +60,7 @@ angular.module('BE.seed.controller.update_item_labels_modal', []).controller('up // in this modal... createdLabel.is_checked_add = true; - $scope.newLabelForm.$setPristine(); + form.$setPristine(); $scope.labels.unshift(createdLabel); $scope.initialize_new_label(); }, diff --git a/seed/static/seed/js/services/simple_modal_service.js b/seed/static/seed/js/services/simple_modal_service.js index fd69815c63..6ab6e65705 100644 --- a/seed/static/seed/js/services/simple_modal_service.js +++ b/seed/static/seed/js/services/simple_modal_service.js @@ -75,7 +75,7 @@ angular.module('BE.seed.service.simple_modal', []).factory('simple_modal_service // Map modal.html $scope custom properties to defaults defined in service angular.extend(tempModalOptions, modalOptions, customModalOptions); - tempModalDefaults.controller = ($scope, $uibModalInstance) => { + tempModalDefaults.controller = ['$scope', '$uibModalInstance', ($scope, $uibModalInstance) => { $scope.modalOptions = tempModalOptions; $scope.modalOptions.ok = () => { $uibModalInstance.close(tempModalOptions.okResult); @@ -83,8 +83,7 @@ angular.module('BE.seed.service.simple_modal', []).factory('simple_modal_service $scope.modalOptions.cancel = () => { $uibModalInstance.dismiss('cancel'); }; - }; - + }]; return $uibModal.open(tempModalDefaults).result; }; @@ -96,6 +95,7 @@ angular.module('BE.seed.service.simple_modal', []).factory('simple_modal_service */ function showModal(customModalOptions, customModalDefaults) { if (customModalOptions && customModalOptions.type !== null) { + if (!_.includes(validModalTypes, customModalOptions.type)) { throw new Error('Invalid modal type'); }