CRM-14726 - crmCaseType - Add simple <UL> listing of case-types
authorTim Otten <totten@civicrm.org>
Wed, 28 May 2014 04:39:53 +0000 (21:39 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 28 May 2014 04:39:53 +0000 (21:39 -0700)
js/angular-crmCaseType.js
partials/crmCaseType/list.html [new file with mode: 0644]

index afc457787c9019bec2cb17cc51c81e44c9e57638..ddcd34f04af0c1a51cf9627fde6849eda8165dbd 100644 (file)
 
   crmCaseType.config(['$routeProvider',
     function($routeProvider) {
+      $routeProvider.when('/caseType', {
+        templateUrl: partialUrl('list.html'),
+        controller: 'CaseTypeListCtrl',
+        resolve: {
+          caseTypes: function($route, crmApi) {
+            return crmApi('CaseType', 'get', {});
+          }
+        }
+      });
       $routeProvider.when('/caseType/:id', {
         templateUrl: partialUrl('edit.html'),
         controller: 'CaseTypeCtrl',
     });
   });
 
+  crmCaseType.controller('CaseTypeListCtrl', function($scope, crmApi, caseTypes) {
+    $scope.caseTypes = caseTypes.values;
+  });
+
 })(angular, CRM.$, CRM._);
\ No newline at end of file
diff --git a/partials/crmCaseType/list.html b/partials/crmCaseType/list.html
new file mode 100644 (file)
index 0000000..af75e52
--- /dev/null
@@ -0,0 +1,9 @@
+<!--
+Controller: CaseTypeListsCtrl
+Required vars: caseTypes
+-->
+<ul>
+  <li ng-repeat="caseType in caseTypes">
+    <a ng-href="#/caseType/{{caseType.id}}">{{caseType.title}}</a>
+  </li>
+</ul>
\ No newline at end of file