X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=ang%2Fapi4Explorer%2FExplorer.js;h=fb9f5c71ce0d03ccc3c7218e65de3734b5492681;hb=7a4cf12713cec62bac2324e25c49d152cef648df;hp=7c64b6e6671c9d1e39d974db47e59bce121fed48;hpb=600ad3573c4a60dcfda2f800a4ad85f0ff1682b1;p=civicrm-core.git diff --git a/ang/api4Explorer/Explorer.js b/ang/api4Explorer/Explorer.js index 7c64b6e667..fb9f5c71ce 100644 --- a/ang/api4Explorer/Explorer.js +++ b/ang/api4Explorer/Explorer.js @@ -57,7 +57,7 @@ $scope.controls = {}; $scope.langs = ['php', 'js', 'ang', 'cli']; $scope.joinTypes = [{k: false, v: 'FALSE (LEFT JOIN)'}, {k: true, v: 'TRUE (INNER JOIN)'}]; - $scope.bridgeEntities = _.filter(schema, {type: 'BridgeEntity'}); + $scope.bridgeEntities = _.filter(schema, function(entity) {return _.includes(entity.type, 'EntityBridge');}); $scope.code = { php: [ {name: 'oop', label: ts('OOP Style'), code: ''}, @@ -102,7 +102,7 @@ if (lastLetter === 's' || lastLetter === 'x' || lastTwo === 'ch') { return str + 'es'; } - if (lastLetter === 'y' && lastTwo !== 'ey') { + if (lastLetter === 'y' && !_.includes(['ay', 'ey', 'iy', 'oy', 'uy'], lastTwo)) { return str.slice(0, -1) + 'ies'; } return str + 's'; @@ -873,6 +873,7 @@ setHelp($scope.entity, { description: entityInfo.description, comment: entityInfo.comment, + type: entityInfo.type, see: entityInfo.see }); } @@ -1024,75 +1025,86 @@ }; }); - angular.module('api4Explorer').directive('crmApi4Clause', function() { - return { - scope: { - data: '= ($scope.data.skip || 0)) { - if (typeof clause !== 'undefined' && !clause[0]) { - values.splice(index, 1); - } - // Add/remove value if operator allows for one - else if (typeof clause[1] === 'string' && _.contains(clause[1], 'NULL')) { - clause.length = 2; - } else if (typeof clause[1] === 'string' && clause.length === 2) { - clause.push(''); - } - } - }); - }, true); - } - }; + // Add/remove value if operator allows for one + this.changeClauseOperator = function(clause) { + if (_.contains(clause[1], 'NULL')) { + clause.length = 2; + } else if (clause.length === 2) { + clause.push(''); + } + }; + } }); angular.module('api4Explorer').directive('api4ExpValue', function($routeParams, crmApi4) { @@ -1145,7 +1157,7 @@ $el.removeClass('loading').crmSelect2({data: options, multiple: multi}); }); } else if (field.fk_entity) { - $el.crmEntityRef({entity: field.fk_entity, select:{multiple: multi}}); + $el.crmEntityRef({entity: field.fk_entity, select:{multiple: multi}, static: field.fk_entity === 'Contact' ? ['user_contact_id'] : []}); } else if (dataType === 'Boolean') { $el.attr('placeholder', ts('- select -')).crmSelect2({allowClear: false, multiple: multi, placeholder: ts('- select -'), data: [ {id: 'true', text: ts('Yes')},