| 1 | (function(angular, $, _) { |
| 2 | |
| 3 | // This directive formats the data in appMeta.perm as a nice table. |
| 4 | // example: <div crm-cxn-perm-table="{perm: cxn.app_meta.perm}"></div> |
| 5 | angular.module('crmCxn').directive('crmCxnPermTable', function crmCxnPermTable() { |
| 6 | return { |
| 7 | restrict: 'EA', |
| 8 | scope: { |
| 9 | crmCxnPermTable: '=' |
| 10 | }, |
| 11 | templateUrl: '~/crmCxn/PermTable.html', |
| 12 | link: function(scope, element, attrs) { |
| 13 | scope.ts = CRM.ts(null); |
| 14 | scope.hasRequiredFilters = function(api) { |
| 15 | return !_.isEmpty(api.required); |
| 16 | }; |
| 17 | scope.isString = function(v) { |
| 18 | return _.isString(v); |
| 19 | }; |
| 20 | scope.apiExplorerUrl = CRM.url('civicrm/api'); |
| 21 | scope.$watch('crmCxnPermTable', function(crmCxnPermTable){ |
| 22 | scope.perm = crmCxnPermTable.perm; |
| 23 | }); |
| 24 | } |
| 25 | }; |
| 26 | }); |
| 27 | })(angular, CRM.$, CRM._); |