add display only type
authorKurund Jalmi <kurundjalmi@thirdsectordesign.org>
Mon, 8 Aug 2022 12:02:19 +0000 (13:02 +0100)
committerKurund Jalmi <kurundjalmi@thirdsectordesign.org>
Mon, 8 Aug 2022 12:02:19 +0000 (13:02 +0100)
ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js
ext/afform/admin/ang/afGuiEditor/inputType/DisplayOnly.html [new file with mode: 0644]
ext/afform/core/ang/af/fields/DisplayOnly.html [new file with mode: 0644]

index 0102c32e9bf1dd73e46337d8b9ffdea47a84d7a3..4951624715d779ce077ffccacb308b3a5240a851 100644 (file)
           case 'Number':
             return !(defn.options || defn.data_type === 'Boolean');
 
+          case 'DisplayOnly':
+            return true;
+
           default:
             return false;
         }
diff --git a/ext/afform/admin/ang/afGuiEditor/inputType/DisplayOnly.html b/ext/afform/admin/ang/afGuiEditor/inputType/DisplayOnly.html
new file mode 100644 (file)
index 0000000..c44ad2b
--- /dev/null
@@ -0,0 +1,3 @@
+<div class="form-inline">
+  <input class="form-control" ng-model-options="$ctrl.editor.debounceWithGetterSetter" type="text" title="{{:: ts('Field value will be shown on the form') }}" disabled/>
+</div>
diff --git a/ext/afform/core/ang/af/fields/DisplayOnly.html b/ext/afform/core/ang/af/fields/DisplayOnly.html
new file mode 100644 (file)
index 0000000..7d4a696
--- /dev/null
@@ -0,0 +1 @@
+{{dataProvider.getFieldData()[$ctrl.fieldName]}}