CRM-14480 - crmCaseType - Prettier URL construction
authorTim Otten <totten@civicrm.org>
Sun, 20 Apr 2014 21:06:33 +0000 (14:06 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 20 May 2014 03:15:26 +0000 (20:15 -0700)
js/angular-crmCaseType.js
partials/crmCaseType/edit.html

index 60f74762d137e9ba301e218957798025c5329fd8..fbb319a2abc606b820b8abd7438926b14683942b 100644 (file)
@@ -1,19 +1,22 @@
 (function(angular, $, _) {
 
-  var partialsUrl = CRM.resourceUrls['civicrm'] + '/partials/crmCaseType';
+  var partialUrl = function(relPath) {
+    return CRM.resourceUrls['civicrm'] + '/partials/crmCaseType/' + relPath;
+  } ;
+
   var crmCaseType = angular.module('crmCaseType', ['ngRoute', 'ui.utils']);
 
   crmCaseType.config(['$routeProvider',
     function($routeProvider) {
       $routeProvider.when('/caseType/:id', {
-        templateUrl: partialsUrl + '/edit.html',
+        templateUrl: partialUrl('edit.html'),
         controller: 'CaseTypeCtrl'
       });
     }
   ]);
 
   crmCaseType.controller('CaseTypeCtrl', function($scope) {
-    $scope.partialsUrl = partialsUrl;
+    $scope.partialUrl = partialUrl;
 
     $scope.workflows = {
       'timeline': 'Timeline',
      */
     $scope.activityTableTemplate = function(activitySet) {
       if (activitySet.timeline) {
-        return partialsUrl + '/timelineTable.html';
+        return partialUrl('timelineTable.html');
       } else if (activitySet.pipeline) {
-        return partialsUrl + '/pipelineTable.html';
+        return partialUrl('pipelineTable.html');
       } else {
         return '';
       }
index 599fe03b4189bdb4c972296297260c0d8fccb263..7f82988c69ef7d61c30a0e770bc1defa87fb2c78 100644 (file)
@@ -3,11 +3,11 @@ Controller: CaseTypeCtrl
 Required vars: caseType
 -->
 <div class="crm-block crm-form-block crmCaseType">
-  <div ng-include="partialsUrl + '/caseTypeDetails.html'"></div>
+  <div ng-include="partialUrl('caseTypeDetails.html')"></div>
 
   <h2>Roles</h2>
 
-  <div ng-include="partialsUrl + '/rolesTable.html'"></div>
+  <div ng-include="partialUrl('rolesTable.html')"></div>
 
   <h2>Activities</h2>
 
@@ -27,7 +27,7 @@ Required vars: caseType
     </ul>
 
     <div id="acttab-actType">
-      <div ng-include="partialsUrl + '/activityTypesTable.html'"></div>
+      <div ng-include="partialUrl('activityTypesTable.html')"></div>
     </div>
 
     <div ng-repeat="activitySet in caseType.definition.activitySets" id="acttab-{{$index}}">
@@ -35,7 +35,7 @@ Required vars: caseType
 
       <div ui-jq="accordion" ui-options="{collapsible: true, active: false, heightStyle: 'fill'}">
         <h3>Advanced</h3>
-        <div ng-include="partialsUrl + '/activitySetDetails.html'" style="display:none;"></div>
+        <div ng-include="partialUrl('activitySetDetails.html')" style="display:none;"></div>
       </div>
     </div>
   </div>