summaryrefslogtreecommitdiff
path: root/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmCxn/PermTable.js
blob: eb7da355c307084e368f95862293c9a372805b56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(function(angular, $, _) {

  // This directive formats the data in appMeta.perm as a nice table.
  // example: <div crm-cxn-perm-table="{perm: cxn.app_meta.perm}"></div>
  angular.module('crmCxn').directive('crmCxnPermTable', function crmCxnPermTable() {
    return {
      restrict: 'EA',
      scope: {
        crmCxnPermTable: '='
      },
      templateUrl: '~/crmCxn/PermTable.html',
      link: function(scope, element, attrs) {
        scope.ts = CRM.ts(null);
        scope.hasRequiredFilters = function(api) {
          return !_.isEmpty(api.required);
        };
        scope.isString = function(v) {
          return _.isString(v);
        };
        scope.apiExplorerUrl = CRM.url('civicrm/api');
        scope.$watch('crmCxnPermTable', function(crmCxnPermTable){
          scope.perm = crmCxnPermTable.perm;
        });
      }
    };
  });
})(angular, CRM.$, CRM._);