AfformGui - Specify admin tpl in entity config file & fall-back to generic
authorColeman Watts <coleman@civicrm.org>
Sun, 25 Apr 2021 17:51:51 +0000 (13:51 -0400)
committerColeman Watts <coleman@civicrm.org>
Sun, 25 Apr 2021 17:51:51 +0000 (13:51 -0400)
ext/afform/admin/afformEntities/Household.php
ext/afform/admin/afformEntities/Individual.php
ext/afform/admin/afformEntities/Organization.php
ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js
ext/afform/admin/ang/afGuiEditor/afGuiEntity.html
ext/afform/admin/ang/afGuiEditor/entityConfig/Activity.html [deleted file]

index 00173428d7c18e12840fe13a796f1726ef2bb04c..cf569b3432ce2f54dbbd554f125f47244299e9ef 100644 (file)
@@ -13,4 +13,5 @@ return [
   'boilerplate' => [
     ['#tag' => 'afblock-name-household'],
   ],
+  'admin_tpl' => '~/afGuiEditor/entityConfig/Contact.html',
 ];
index b6c972754bf41c11c357215d4526824ff18d5326..cc580425e4ee434c1eff6d1b57efd33c4698134c 100644 (file)
@@ -13,4 +13,5 @@ return [
   'boilerplate' => [
     ['#tag' => 'afblock-name-individual'],
   ],
+  'admin_tpl' => '~/afGuiEditor/entityConfig/Contact.html',
 ];
index aba69f9f44d5fddfbb27bed75439edda44dee13a..5335b6ddc212e7bbeba6283c7c18c4d3c1753e7b 100644 (file)
@@ -13,4 +13,5 @@ return [
   'boilerplate' => [
     ['#tag' => 'afblock-name-organization'],
   ],
+  'admin_tpl' => '~/afGuiEditor/entityConfig/Contact.html',
 ];
index 721c41ec6ea4641c287d5612f46f02a7c347e789..e2d2c249a833d7a5f968373f2635fc9a12eb6e0b 100644 (file)
         return afGui.meta.entities[getEntityType()];
       };
 
+      $scope.getAdminTpl = function() {
+        return $scope.getMeta().admin_tpl || '~/afGuiEditor/entityConfig/Generic.html';
+      };
+
       $scope.getField = afGui.getField;
 
       $scope.valuesFields = function() {
index eed6f6e7c9c560df12bebe27c10b02bb79c4b57a..1c337c553dc0a3c4f1388389b762f5d3774dc3d2 100644 (file)
@@ -56,5 +56,5 @@
 
 <fieldset ng-if="!$ctrl.entity.loading && $ctrl.editor.allowEntityConfig">
   <legend>{{:: ts('Options') }}</legend>
-  <div ng-include="::'~/afGuiEditor/entityConfig/' + $ctrl.entity.type + '.html'"></div>
+  <div ng-include=":: getAdminTpl()"></div>
 </fieldset>
diff --git a/ext/afform/admin/ang/afGuiEditor/entityConfig/Activity.html b/ext/afform/admin/ang/afGuiEditor/entityConfig/Activity.html
deleted file mode 100644 (file)
index 15e56f1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<div ng-include="'~/afGuiEditor/entityConfig/Generic.html'"></div>