afformHtmlEditor - Add "Save" button
authorTim Otten <totten@civicrm.org>
Sun, 5 May 2019 23:15:42 +0000 (16:15 -0700)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:18 +0000 (19:13 -0700)
ext/afform/html/ang/afformHtmlEditor.aff.html

index 83c712cc8c38642a74c29cadbf06745ada4d8858..db22d1fcb461c44513e9250c60584dfff100be05 100644 (file)
@@ -2,15 +2,17 @@
      aff-api4="['Afform', 'get', {layoutFormat: 'html', where: [['name', '=', options.name]]}]"
      aff-api4-ctrl="apiData">
 
-  <div>
-    <a ng-href="#/">{{ts('Back')}}</a>
-  </div>
-
   <div ng-if="apiData.result.length == 0">
     {{ts('Failed to find requested form.')}}
   </div>
 
   <div ng-repeat="resultForm in apiData.result" ng-if="apiData.result.length > 0">
+    <div>
+      <a ng-href="#/">{{ts('Back')}}</a>
+      |
+      <a aff-api4-action="['Afform', 'update', {layoutFormat: 'html', where: [['name', '=', resultForm.name]], values:{layout: resultForm.layout}}]">{{ts('Save')}}</a>
+    </div>
+
     <div crm-ui-debug="resultForm.layout"></div>
     <div af-monaco ng-model="resultForm.layout"></div>
   </div>