From cdde5624bac14ba6e0520a2d30d8d3926f2cc27f Mon Sep 17 00:00:00 2001
From: Sam Wilkins <samwilkins333@gmail.com>
Date: Mon, 20 Jan 2020 12:19:40 -0500
Subject: buxton layout improvements

---
 .../views/collections/CollectionTreeView.tsx       | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

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

diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 0f61756f4..a48208bd9 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -633,27 +633,33 @@ export class CollectionTreeView extends CollectionSubView(Document) {
         }
         ContextMenu.Instance.addItem({
             description: "Buxton Layout", icon: "eye", event: () => {
-                // const [first, second, third] = new Array(3).map(() => Docs.Create.MulticolumnDocument([], {}));
-                const year = Docs.Create.TextDocument({ title: "year" });
-                const wrapper = Docs.Create.StackingDocument([year], { autoHeight: true, chromeStatus: "disabled" });
+                const { TextDocument, ImageDocument } = Docs.Create;
+                const wrapper = Docs.Create.StackingDocument([
+                    ImageDocument("http://www.cs.brown.edu/~bcz/face.gif", { title: "hero" }),
+                    TextDocument({ title: "year" }),
+                    TextDocument({ title: "degrees_of_freedom" }),
+                    TextDocument({ title: "company" }),
+                    TextDocument({ title: "short_description" }),
+                ], { autoHeight: true, chromeStatus: "disabled" });
                 wrapper.disableLOD = true;
-                makeTemplate(wrapper);
-                delete Doc.GetProto(year).showTitle;
-                delete year.showTitle;
-
+                makeTemplate(wrapper, true);
                 const detailedLayout = Doc.MakeAlias(wrapper);
                 const cardLayout = ImageBox.LayoutString("hero");
                 this.childLayoutPairs.forEach(({ layout }) => {
-                    Doc.GetProto(layout).layout = cardLayout;
-                    Doc.GetProto(layout).layout_detailed = detailedLayout;
-                    // Doc.ApplyTemplateTo(wrapper, layout, "layout_detailed");
+                    const proto = Doc.GetProto(layout);
+                    proto.layout = cardLayout;
+                    proto.layout_detailed = detailedLayout;
+                    layout.showTitle = "title";
+                    layout.showTitleHover = "titlehover";
                 });
-                CollectionDockingView.AddRightSplit(wrapper, undefined);
             }
         });
         const existingOnClick = ContextMenu.Instance.findByDescription("OnClick...");
         const onClicks: ContextMenuProps[] = existingOnClick && "subitems" in existingOnClick ? existingOnClick.subitems : [];
-        onClicks.push({ description: "Edit onChecked Script", icon: "edit", event: (obj: any) => ScriptBox.EditButtonScript("On Checked Changed ...", this.props.Document, "onCheckedClick", obj.x, obj.y, { heading: "boolean", checked: "boolean" }) });
+        onClicks.push({
+            description: "Edit onChecked Script", icon: "edit", event: (obj: any) => ScriptBox.EditButtonScript("On Checked Changed ...", this.props.Document,
+                "onCheckedClick", obj.x, obj.y, { heading: "boolean", checked: "boolean", context: Doc.name })
+        });
         !existingOnClick && ContextMenu.Instance.addItem({ description: "OnClick...", subitems: onClicks, icon: "hand-point-right" });
     }
     outerXf = () => Utils.GetScreenTransform(this._mainEle!);
-- 
cgit v1.2.3-70-g09d2

