From 978881c2b372436876ff8bf4c4809c906e7232bf Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 29 Jul 2021 13:26:01 -0700 Subject: [PATCH] msgtplui - (WIP) Add icon to edit example data This converts the example to JSON and puts up an edit blob. Issue: - Edit block is too big (*should only be 15%...*) - Need to regen JSON when navigating between examples - Need to periodically refresh example --- ext/msgtplui/ang/msgtplui/Preview.html | 12 ++++++++++++ ext/msgtplui/ang/msgtplui/Preview.js | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/ext/msgtplui/ang/msgtplui/Preview.html b/ext/msgtplui/ang/msgtplui/Preview.html index a3ddd17782..e3c6b28fee 100644 --- a/ext/msgtplui/ang/msgtplui/Preview.html +++ b/ext/msgtplui/ang/msgtplui/Preview.html @@ -1,5 +1,7 @@
+
+
+
+ +
+
+

{{ts('Changes to this data are temporary.')}}

+
+
diff --git a/ext/msgtplui/ang/msgtplui/Preview.js b/ext/msgtplui/ang/msgtplui/Preview.js index d153d469e5..91684634cd 100644 --- a/ext/msgtplui/ang/msgtplui/Preview.js +++ b/ext/msgtplui/ang/msgtplui/Preview.js @@ -13,6 +13,13 @@ $ctrl[idFld] = ($ctrl[idFld] + delta) % model[listFld].length; }; + $ctrl.adhocExample = {}; + $ctrl.isAdhocExample = false; + $ctrl.toggleAdhoc = function(value){ + $ctrl.isAdhocExample = !$ctrl.isAdhocExample; + $ctrl.adhocExampleJson = angular.toJson(model.examples[$ctrl.exampleId], 2); + }; + var lastId = null; var update = function update() { var id = $ctrl.revisionId + ':' + $ctrl.exampleId; -- 2.25.1