From 87dcd90943cbdd304183b3c50dfea45081edca42 Mon Sep 17 00:00:00 2001 From: kurund Date: Thu, 29 May 2014 22:13:20 +0530 Subject: [PATCH] allow creation of new case type CRM-14480 ---------------------------------------- * CRM-14480: Implement "Edit Case Type" screen https://issues.civicrm.org/jira/browse/CRM-14480 --- js/angular-crmCaseType.js | 15 +++++++++------ partials/crmCaseType/caseTypeDetails.html | 2 +- partials/crmCaseType/list.html | 4 +++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/js/angular-crmCaseType.js b/js/angular-crmCaseType.js index ddcd34f04a..4ce66ac555 100644 --- a/js/angular-crmCaseType.js +++ b/js/angular-crmCaseType.js @@ -8,8 +8,7 @@ var newCaseTypeDefinitionTemplate = { activityTypes: [ - {name: 'Open Case', max_instances: 1 }, - {name: 'Example activity'} + {name: 'Open Case', max_instances: 1 } ], activitySets: [ { @@ -17,8 +16,7 @@ label: 'Standard Timeline', timeline: '1', // Angular won't bind checkbox correctly with numeric 1 activityTypes: [ - {name: 'Open Case', status: 'Completed' }, - {name: 'Example activity', reference_activity: 'Open Case', reference_offset: 3, reference_select: 'newest'} + {name: 'Open Case', status: 'Completed' } ] } ], @@ -43,7 +41,12 @@ controller: 'CaseTypeCtrl', resolve: { selectedCaseType: function($route, crmApi) { - return crmApi('CaseType', 'getsingle', {id: $route.current.params.id}); + if ( $route.current.params.id !== 'new') { + return crmApi('CaseType', 'getsingle', {id: $route.current.params.id}); + } + else { + return { title: "New case type", name: "New case type", definition: _.extend({}, newCaseTypeDefinitionTemplate) }; + } } } }); @@ -78,7 +81,7 @@ }; $scope.caseType = selectedCaseType; - $scope.caseType.definition = $scope.caseType.definition || _.extend({}, newCaseTypeDefinitionTemplate); + $scope.caseType.definition = $scope.caseType.definition || []; $scope.caseType.definition.activityTypes = $scope.caseType.definition.activityTypes || []; $scope.caseType.definition.activitySets = $scope.caseType.definition.activitySets || []; $scope.caseType.definition.caseRoles = $scope.caseType.definition.caseRoles || []; diff --git a/partials/crmCaseType/caseTypeDetails.html b/partials/crmCaseType/caseTypeDetails.html index 912b40745a..c70c889480 100644 --- a/partials/crmCaseType/caseTypeDetails.html +++ b/partials/crmCaseType/caseTypeDetails.html @@ -15,7 +15,7 @@ The original form used table layout; don't know if we have an alternative, CSS-b Name - + diff --git a/partials/crmCaseType/list.html b/partials/crmCaseType/list.html index af75e52176..d3e0923b2a 100644 --- a/partials/crmCaseType/list.html +++ b/partials/crmCaseType/list.html @@ -6,4 +6,6 @@ Required vars: caseTypes
  • {{caseType.title}}
  • - \ No newline at end of file + + +New Case \ No newline at end of file -- 2.25.1