From cf86d1b7917f0317af550293344f784a341bd7b9 Mon Sep 17 00:00:00 2001
From: Tyler Schicke <tyler_schicke@brown.edu>
Date: Tue, 9 Apr 2019 02:45:06 -0400
Subject: Added script field and added list of scripts to list field

---
 src/client/views/collections/CollectionBaseView.tsx | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

(limited to 'src/client/views/collections/CollectionBaseView.tsx')

diff --git a/src/client/views/collections/CollectionBaseView.tsx b/src/client/views/collections/CollectionBaseView.tsx
index 32462a4c1..4afa7cbf6 100644
--- a/src/client/views/collections/CollectionBaseView.tsx
+++ b/src/client/views/collections/CollectionBaseView.tsx
@@ -10,6 +10,8 @@ import { ListField } from '../../../fields/ListField';
 import { action } from 'mobx';
 import { Transform } from '../../util/Transform';
 import { observer } from 'mobx-react';
+import { CompileScript } from '../../util/Scripting';
+import { ScriptField } from '../../../fields/ScriptField';
 
 export enum CollectionViewType {
     Invalid,
@@ -106,7 +108,24 @@ export class CollectionBaseView extends React.Component<CollectionViewProps> {
         } else {
             let proto = props.Document.GetPrototype();
             if (!proto || proto === FieldWaiting || !this.createsCycle(proto, doc)) {
-                props.Document.SetOnPrototype(props.fieldKey, new ListField([doc]));
+                const field = new ListField([doc]);
+                // const script = CompileScript(`
+                //     if(added) {
+                //         console.log("added " + field.Title);
+                //     } else {
+                //         console.log("removed " + field.Title);
+                //     }
+                // `, {
+                //         addReturn: false,
+                //         params: {
+                //             field: Document.name,
+                //             added: "boolean"
+                //         }
+                //     });
+                // if (script.compiled) {
+                //     field.addScript(new ScriptField(script));
+                // }
+                props.Document.SetOnPrototype(props.fieldKey, field);
             }
             else {
                 return false;
-- 
cgit v1.2.3-70-g09d2

