add form to input terms
authorDavid Kaufmann <david.kaufmann@student.tuwien.ac.at>
Tue, 6 Nov 2018 21:11:01 +0000 (22:11 +0100)
committerDavid Kaufmann <david.kaufmann@student.tuwien.ac.at>
Tue, 6 Nov 2018 21:11:01 +0000 (22:11 +0100)
sentiment-analysis/src/main/webapp/forms/input-terms.html [new file with mode: 0644]

diff --git a/sentiment-analysis/src/main/webapp/forms/input-terms.html b/sentiment-analysis/src/main/webapp/forms/input-terms.html
new file mode 100644 (file)
index 0000000..20f54df
--- /dev/null
@@ -0,0 +1,50 @@
+<form name="twitterForm" role="form">
+  <script cam-script type="text/form-script">
+    // angular form works on scope object
+    var terms = $scope.terms = [];
+
+    // scope function which adds a new term
+    $scope.addTerm = function() {
+      terms.push({});
+    };
+
+    camForm.on('form-loaded', function() {
+      // declare variable 'terms' incuding metadata for serialization
+      camForm.variableManager.createVariable({
+        name: 'terms',
+        type: 'Object',
+        value: terms,
+        valueInfo: {
+          // indicate that object is serialized as json
+          serializationDataFormat: 'application/json',
+          // provide classname of java object
+          objectTypeName: 'at.ac.tuwien.infosys.aic.serialized.model.Terms'
+        }
+      });
+
+    });
+
+  </script>
+
+  <h3>Terms</h3>
+
+  <div>
+      <a href
+         ng-click="addTerm()"
+         class="btn btn-default">Add</a>
+         <hr/>
+
+    <div ng-repeat="term in terms">
+      <div class="control-group">
+        <label class="control-label" for="name">Name</label>
+        <div class="controls">
+          <input id="name"
+                 class="form-control"
+                 type="text"
+                 required
+                 ng-model="term">
+        </div>
+      </div>
+    </div>
+  </div>
+</form>