From: kurund Date: Thu, 29 May 2014 16:43:20 +0000 (+0530) Subject: allow creation of new case type CRM-14480 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=87dcd90943cbdd304183b3c50dfea45081edca42;p=civicrm-core.git allow creation of new case type CRM-14480 ---------------------------------------- * CRM-14480: Implement "Edit Case Type" screen https://issues.civicrm.org/jira/browse/CRM-14480 --- 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