afform_html - Split main screen into two smaller components
authorTim Otten <totten@civicrm.org>
Sun, 5 May 2019 22:54:24 +0000 (15:54 -0700)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:18 +0000 (19:13 -0700)
* Before: `afformHtmlEditor` contains list and edit screens
* After: `afformHtmlEditor` contains just the edit screen
* After: `afforHtmlList` contains just the list screen
* After: `afforHtmlAdmin` delegates to `afforHtmlList` and `afformHtmlEditor`

ext/afform/html/ang/afformHtmlAdmin.aff.html [new file with mode: 0644]
ext/afform/html/ang/afformHtmlAdmin.aff.json [new file with mode: 0644]
ext/afform/html/ang/afformHtmlEditor.aff.html
ext/afform/html/ang/afformHtmlEditor.aff.json
ext/afform/html/ang/afformHtmlList.aff.html [new file with mode: 0644]
ext/afform/html/ang/afformHtmlList.aff.json [new file with mode: 0644]

diff --git a/ext/afform/html/ang/afformHtmlAdmin.aff.html b/ext/afform/html/ang/afformHtmlAdmin.aff.html
new file mode 100644 (file)
index 0000000..c8f3a7e
--- /dev/null
@@ -0,0 +1,7 @@
+<div ng-if="!routeParams.name">
+  <div afform-html-list=""></div>
+</div>
+
+<div ng-if="routeParams.name">
+  <div afform-html-editor="{name: routeParams.name}"></div>
+</div>
diff --git a/ext/afform/html/ang/afformHtmlAdmin.aff.json b/ext/afform/html/ang/afformHtmlAdmin.aff.json
new file mode 100644 (file)
index 0000000..ff99ac0
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "title": "Afform HTML Administration",
+  "server_route": "civicrm/admin/afform-html",
+  "requires":["afformCore", "afMoncao", "afformHtmlEditor", "afformHtmlList"]
+}
index eca4e8f6653d1ecc2c05023612b6faba5981c612..83c712cc8c38642a74c29cadbf06745ada4d8858 100644 (file)
@@ -1,46 +1,5 @@
-<div ng-if="!routeParams.name">
-  <div
-    aff-api4="['Afform', 'get', {select: ['name','title','is_public','server_route'], orderBy: {name:'ASC'}}]"
-    aff-api4-ctrl="listCtrl">
-
-    <div ng-if="apiData.result.length == 0">
-      {{ts('There are no forms! Tell Aristotle!')}}
-    </div>
-
-    <table>
-      <thead>
-        <tr>
-          <th>{{ts('Name')}}</th>
-          <th>{{ts('Title')}}</th>
-          <th>{{ts('Server Route')}}</th>
-          <th>{{ts('Frontend?')}}</th>
-          <th></th>
-        </tr>
-      </thead>
-      <tbody>
-      <tr ng-repeat="availForm in listCtrl.result">
-        <td>
-          <a ng-href="#/?name={{availForm.name}}">{{availForm.name}}</a>
-        </td>
-        <td>{{availForm.title}}</td>
-        <td><code>{{availForm.server_route}}</code></td>
-        <td>{{availForm.is_public ? ts('Frontend') : ts('Backend')}}</td>
-        <td>
-          <!--<a ng-click="crmStatus({start: ts('Reverting...'), success: ts('Reverted')}, crmApi4('Afform', 'revert', {where: [['name', '=', availForm.name]]}))">{{ts('Revert')}}</a>-->
-          <a aff-api4-action="['Afform', 'revert', {where: [['name','=', availForm.name]]}]"
-             msg-start="ts('Reverting...')"
-             msg-success="ts('Reverted')"
-            >{{ts('Revert')}}</a>
-        </td>
-      </tr>
-      </tbody>
-    </table>
-
-  </div>
-</div>
-
-<div ng-if="routeParams.name"
-     aff-api4="['Afform', 'get', {layoutFormat: 'html', where: [['name', '=', routeParams.name]]}]"
+<div 
+     aff-api4="['Afform', 'get', {layoutFormat: 'html', where: [['name', '=', options.name]]}]"
      aff-api4-ctrl="apiData">
 
   <div>
@@ -55,4 +14,5 @@
     <div crm-ui-debug="resultForm.layout"></div>
     <div af-monaco ng-model="resultForm.layout"></div>
   </div>
+
 </div>
index ce82be9ed43b76c3e02c677bb17abc6123d0ea07..3f7f53f4b2073274cdbd27672dfdfbbf861e6f22 100644 (file)
@@ -1,5 +1,4 @@
 {
   "title": "Afform HTML Editor",
-  "server_route": "civicrm/admin/afform-html",
   "requires":["afformCore", "afMoncao"]
 }
diff --git a/ext/afform/html/ang/afformHtmlList.aff.html b/ext/afform/html/ang/afformHtmlList.aff.html
new file mode 100644 (file)
index 0000000..b6ccc76
--- /dev/null
@@ -0,0 +1,38 @@
+<div
+  aff-api4="['Afform', 'get', {select: ['name','title','is_public','server_route'], orderBy: {name:'ASC'}}]"
+  aff-api4-ctrl="listCtrl">
+
+  <div ng-if="apiData.result.length == 0">
+    {{ts('There are no forms! Tell Aristotle!')}}
+  </div>
+
+  <table>
+    <thead>
+      <tr>
+        <th>{{ts('Name')}}</th>
+        <th>{{ts('Title')}}</th>
+        <th>{{ts('Server Route')}}</th>
+        <th>{{ts('Frontend?')}}</th>
+        <th></th>
+      </tr>
+    </thead>
+    <tbody>
+    <tr ng-repeat="availForm in listCtrl.result">
+      <td>
+        <a ng-href="#/?name={{availForm.name}}">{{availForm.name}}</a>
+      </td>
+      <td>{{availForm.title}}</td>
+      <td><code>{{availForm.server_route}}</code></td>
+      <td>{{availForm.is_public ? ts('Frontend') : ts('Backend')}}</td>
+      <td>
+        <!--<a ng-click="crmStatus({start: ts('Reverting...'), success: ts('Reverted')}, crmApi4('Afform', 'revert', {where: [['name', '=', availForm.name]]}))">{{ts('Revert')}}</a>-->
+        <a aff-api4-action="['Afform', 'revert', {where: [['name','=', availForm.name]]}]"
+           msg-start="ts('Reverting...')"
+           msg-success="ts('Reverted')"
+          >{{ts('Revert')}}</a>
+      </td>
+    </tr>
+    </tbody>
+  </table>
+
+</div>
diff --git a/ext/afform/html/ang/afformHtmlList.aff.json b/ext/afform/html/ang/afformHtmlList.aff.json
new file mode 100644 (file)
index 0000000..a207554
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "title": "Afform HTML List",
+  "requires":["afformCore"]
+}