diff --git a/app/scripts/directives/blockEditor.js b/app/scripts/directives/blockEditor.js index 5b4268cfc..078e5d1d8 100644 --- a/app/scripts/directives/blockEditor.js +++ b/app/scripts/directives/blockEditor.js @@ -325,18 +325,23 @@ angular.module('confRegistrationWebApp').directive('blockEditor', function () { }); }); if (profileCount > 1) { + const pType = + $scope.block.profileType == 'GENDER' + ? 'Sex' + : $scope.block.profileType.charAt(0).toUpperCase() + + $scope.block.profileType + .split('_') + .join(' ') + .slice(1) + .toLowerCase(); modalMessage.error( - 'Only one ' + - $scope.block.profileType.charAt(0).toUpperCase() + - $scope.block.profileType.slice(1).toLowerCase() + - ' profile block can be used per form.', + 'Only one ' + pType + ' profile block can be used per form.', ); $scope.block.profileType = null; $scope.profileCheck = false; } } }; - $scope.registrationTypeName = function (id) { if (!id) { return; diff --git a/test/spec/testData.spec.js b/test/spec/testData.spec.js index 4f75a0152..286d4f4ab 100644 --- a/test/spec/testData.spec.js +++ b/test/spec/testData.spec.js @@ -161,7 +161,7 @@ angular.module('confRegistrationWebApp').service('testData', function () { required: false, position: 6, content: '', - profileType: null, + profileType: 'GENDER', registrantTypes: [], rules: [], }, @@ -302,6 +302,19 @@ angular.module('confRegistrationWebApp').service('testData', function () { }, ], }, + { + id: '9b83eebd-b064-4edf-92d0-7982a330272b', + pageId: '7b4c19df-7377-4d37-90fb-5b262bb66d1a', + title: 'Sex', + exportFieldTitle: null, + type: 'genderQuestion', + required: false, + position: 9, + content: '', + profileType: null, + registrantTypes: [], + rules: [], + }, { adminOnly: 'false', content: {