From 81dd273e11795ea45b2aff17a282556da71b1c29 Mon Sep 17 00:00:00 2001 From: Ivan Paolillo Date: Fri, 22 Jul 2016 10:37:03 +0200 Subject: [PATCH 1/3] Add JSONForms example --- json/src/main/webapp/index.html | 27 +++++++++++++++++++++++++++ json/src/main/webapp/js/app.js | 15 +++++++++++++++ json/src/main/webapp/js/schema.js | 27 +++++++++++++++++++++++++++ json/src/main/webapp/js/ui-schema.js | 22 ++++++++++++++++++++++ json/src/main/webapp/package.json | 11 +++++++++++ 5 files changed, 102 insertions(+) create mode 100644 json/src/main/webapp/index.html create mode 100644 json/src/main/webapp/js/app.js create mode 100644 json/src/main/webapp/js/schema.js create mode 100644 json/src/main/webapp/js/ui-schema.js create mode 100644 json/src/main/webapp/package.json diff --git a/json/src/main/webapp/index.html b/json/src/main/webapp/index.html new file mode 100644 index 0000000000..5c41c8a173 --- /dev/null +++ b/json/src/main/webapp/index.html @@ -0,0 +1,27 @@ + + + + Introduction to JSONForms + + + + + + +
+
+
+
+
+

Introduction to JSONForms

+
+
+ Bound data: {{data}} + +
+
+
+
+
+ + diff --git a/json/src/main/webapp/js/app.js b/json/src/main/webapp/js/app.js new file mode 100644 index 0000000000..484637bef4 --- /dev/null +++ b/json/src/main/webapp/js/app.js @@ -0,0 +1,15 @@ +'use strict'; + +var app = angular.module('jsonforms-intro', ['jsonforms']); +app.controller('MyController', ['$scope', 'Schema', 'UISchema', function($scope, Schema, UISchema) { + + $scope.schema = Schema; + + $scope.uiSchema = UISchema; + + $scope.data = { + "id": 1, + "name": "Lampshade", + "price": 1.85 + }; +}]); diff --git a/json/src/main/webapp/js/schema.js b/json/src/main/webapp/js/schema.js new file mode 100644 index 0000000000..34025868b9 --- /dev/null +++ b/json/src/main/webapp/js/schema.js @@ -0,0 +1,27 @@ +'use strict'; + +var app = angular.module('jsonforms-intro'); +app.value('Schema', + { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Product", + "description": "A product from the catalog", + "type": "object", + "properties": { + "id": { + "description": "The unique identifier for a product", + "type": "integer" + }, + "name": { + "description": "Name of the product", + "type": "string" + }, + "price": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + } + }, + "required": ["id", "name", "price"] + } +); diff --git a/json/src/main/webapp/js/ui-schema.js b/json/src/main/webapp/js/ui-schema.js new file mode 100644 index 0000000000..aea5ac79c0 --- /dev/null +++ b/json/src/main/webapp/js/ui-schema.js @@ -0,0 +1,22 @@ +'use strict'; + +var app = angular.module('jsonforms-intro'); +app.value('UISchema', + { + "type": "HorizontalLayout", + "elements": [ + { + "type": "Control", + "scope": { "$ref": "#/properties/id" } + }, + { + "type": "Control", + "scope": { "$ref": "#/properties/name" } + }, + { + "type": "Control", + "scope": { "$ref": "#/properties/price" } + }, + ] + } +); diff --git a/json/src/main/webapp/package.json b/json/src/main/webapp/package.json new file mode 100644 index 0000000000..66eb42d00e --- /dev/null +++ b/json/src/main/webapp/package.json @@ -0,0 +1,11 @@ +{ + "name": "jsonforms-intro", + "description": "Introduction to JSONForms", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "typings": "0.6.5", + "jsonforms": "0.0.19", + "bootstrap": "3.3.6" + } +} \ No newline at end of file From 4f1c0651c6bac826933b035681c9fe2806a56a80 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Aug 2016 02:10:48 +0200 Subject: [PATCH 2/3] Add JsonForms example --- json/src/main/webapp/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/json/src/main/webapp/package.json b/json/src/main/webapp/package.json index 66eb42d00e..cb7a96797c 100644 --- a/json/src/main/webapp/package.json +++ b/json/src/main/webapp/package.json @@ -4,8 +4,8 @@ "version": "0.0.1", "license": "MIT", "dependencies": { - "typings": "0.6.5", - "jsonforms": "0.0.19", - "bootstrap": "3.3.6" + "typings": "0.6.5", + "jsonforms": "0.0.19", + "bootstrap": "3.3.6" } } \ No newline at end of file From cc9370e8ff446759f6d4a304a650bb591de16e9c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Aug 2016 02:41:23 +0200 Subject: [PATCH 3/3] Add JSONForms example --- json/src/main/webapp/package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/json/src/main/webapp/package.json b/json/src/main/webapp/package.json index cb7a96797c..2f2d6c9ffa 100644 --- a/json/src/main/webapp/package.json +++ b/json/src/main/webapp/package.json @@ -1,11 +1,11 @@ -{ - "name": "jsonforms-intro", - "description": "Introduction to JSONForms", - "version": "0.0.1", - "license": "MIT", - "dependencies": { - "typings": "0.6.5", - "jsonforms": "0.0.19", - "bootstrap": "3.3.6" - } +{ + "name": "jsonforms-intro", + "description": "Introduction to JSONForms", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "typings": "0.6.5", + "jsonforms": "0.0.19", + "bootstrap": "3.3.6" + } } \ No newline at end of file