From 7a27ec8f23a085af08a2881cdaf95a196d4140db Mon Sep 17 00:00:00 2001
From: Sam Wilkins <samwilkins333@gmail.com>
Date: Mon, 20 Jan 2020 00:34:45 -0500
Subject: close to buxton's initial workflow

---
 src/client/views/collections/CollectionTreeView.tsx | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(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 70860b6bd..239e6caa6 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -29,6 +29,8 @@ import "./CollectionTreeView.scss";
 import React = require("react");
 import { CurrentUserUtils } from '../../../server/authentication/models/current_user_utils';
 import { ScriptBox } from '../ScriptBox';
+import { ImageBox } from '../nodes/ImageBox';
+import { makeTemplate } from '../../util/DropConverter';
 
 
 export interface TreeViewProps {
@@ -628,6 +630,21 @@ export class CollectionTreeView extends CollectionSubView(Document) {
             layoutItems.push({ description: (this.props.Document.hideHeaderFields ? "Show" : "Hide") + " Header Fields", event: () => this.props.Document.hideHeaderFields = !this.props.Document.hideHeaderFields, icon: "paint-brush" });
             ContextMenu.Instance.addItem({ description: "Treeview Options ...", subitems: layoutItems, icon: "eye" });
         }
+        ContextMenu.Instance.addItem({
+            description: "Buxton Layout", icon: "eye", event: () => {
+                // const [first, second, third] = new Array(3).map(() => Docs.Create.MulticolumnDocument([], {}));
+                const year = Docs.Create.FreeformDocument([], { title: "year" });
+                const wrapper = Docs.Create.FreeformDocument([year], {});
+                makeTemplate(wrapper);
+                const detailedLayout = Doc.MakeAlias(wrapper);
+                const cardLayout = ImageBox.LayoutString("hero");
+                this.childLayoutPairs.forEach(({ layout }) => {
+                    layout.layout = cardLayout;
+                    layout.detailedDeviceView = detailedLayout;
+                    // Doc.ApplyTemplateTo(wrapper, layout, "detailedDeviceView");
+                });
+            }
+        });
         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" }) });
-- 
cgit v1.2.3-70-g09d2


From e2d6f1d930f0f092d975bd221c45d07a8620efa7 Mon Sep 17 00:00:00 2001
From: bob <bcz@cs.brown.edu>
Date: Mon, 20 Jan 2020 09:20:42 -0500
Subject: nothing changes.

---
 src/client/views/collections/CollectionPivotView.tsx | 2 +-
 src/client/views/collections/CollectionTreeView.tsx  | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

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

diff --git a/src/client/views/collections/CollectionPivotView.tsx b/src/client/views/collections/CollectionPivotView.tsx
index 02cd2e2c9..bada8ff28 100644
--- a/src/client/views/collections/CollectionPivotView.tsx
+++ b/src/client/views/collections/CollectionPivotView.tsx
@@ -34,7 +34,7 @@ export class CollectionPivotView extends CollectionSubView(doc => doc) {
                 facetCollection.onCheckedClick = new ScriptField(script);
             }
 
-            const openDocText = "const alias = getAlias(this); alias.layoutKey = 'detailedDeviceView'; useRightSplit(alias); ";
+            const openDocText = "const alias = getAlias(this); alias.layoutKey = 'layout_detailed'; useRightSplit(alias); ";
             const openDocScript = CompileScript(openDocText, {
                 params: { this: Doc.name, heading: "boolean", checked: "boolean", context: Doc.name },
                 typecheck: false,
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 239e6caa6..abc902491 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -633,15 +633,16 @@ 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.FreeformDocument([], { title: "year" });
+                const year = Docs.Create.TextDocument({ title: "year" });
                 const wrapper = Docs.Create.FreeformDocument([year], {});
+                wrapper.disableLOD = true;
                 makeTemplate(wrapper);
                 const detailedLayout = Doc.MakeAlias(wrapper);
                 const cardLayout = ImageBox.LayoutString("hero");
                 this.childLayoutPairs.forEach(({ layout }) => {
-                    layout.layout = cardLayout;
-                    layout.detailedDeviceView = detailedLayout;
-                    // Doc.ApplyTemplateTo(wrapper, layout, "detailedDeviceView");
+                    Doc.GetProto(layout).layout = cardLayout;
+                    Doc.GetProto(layout).layout_detailed = detailedLayout;
+                    // Doc.ApplyTemplateTo(wrapper, layout, "layout_detailed");
                 });
             }
         });
-- 
cgit v1.2.3-70-g09d2


From 48e4149457f1075748397d4804db9e0c198b5e2e Mon Sep 17 00:00:00 2001
From: Sam Wilkins <samwilkins333@gmail.com>
Date: Mon, 20 Jan 2020 09:58:02 -0500
Subject: templating fixes

---
 src/client/views/collections/CollectionTreeView.tsx | 7 ++++++-
 src/client/views/nodes/DocumentView.tsx             | 2 +-
 2 files changed, 7 insertions(+), 2 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 abc902491..0f61756f4 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -31,6 +31,7 @@ import { CurrentUserUtils } from '../../../server/authentication/models/current_
 import { ScriptBox } from '../ScriptBox';
 import { ImageBox } from '../nodes/ImageBox';
 import { makeTemplate } from '../../util/DropConverter';
+import { CollectionDockingView } from './CollectionDockingView';
 
 
 export interface TreeViewProps {
@@ -634,9 +635,12 @@ export class CollectionTreeView extends CollectionSubView(Document) {
             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.FreeformDocument([year], {});
+                const wrapper = Docs.Create.StackingDocument([year], { autoHeight: true, chromeStatus: "disabled" });
                 wrapper.disableLOD = true;
                 makeTemplate(wrapper);
+                delete Doc.GetProto(year).showTitle;
+                delete year.showTitle;
+
                 const detailedLayout = Doc.MakeAlias(wrapper);
                 const cardLayout = ImageBox.LayoutString("hero");
                 this.childLayoutPairs.forEach(({ layout }) => {
@@ -644,6 +648,7 @@ export class CollectionTreeView extends CollectionSubView(Document) {
                     Doc.GetProto(layout).layout_detailed = detailedLayout;
                     // Doc.ApplyTemplateTo(wrapper, layout, "layout_detailed");
                 });
+                CollectionDockingView.AddRightSplit(wrapper, undefined);
             }
         });
         const existingOnClick = ContextMenu.Instance.findByDescription("OnClick...");
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 8c7361673..29f658eca 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -759,7 +759,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
         return (showTitle && !showTitleHover ? 0 : 0) + 1;
     }
 
-    @computed get finalLayoutKey() { return this.props.layoutKey || StrCast(this.props.Document.layoutKey, "layout"); }
+    @computed get finalLayoutKey() { return this.props.layoutKey || "layout"; }
     childScaling = () => (this.layoutDoc.fitWidth ? this.props.PanelWidth() / this.nativeWidth : this.props.ContentScaling());
     @computed get contents() {
         TraceMobx();
-- 
cgit v1.2.3-70-g09d2


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

---
 src/client/util/DropConverter.ts                   |  4 +--
 .../views/collections/CollectionTreeView.tsx       | 30 +++++++++++++---------
 src/scraping/buxton/scraper.py                     |  2 +-
 3 files changed, 21 insertions(+), 15 deletions(-)

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

diff --git a/src/client/util/DropConverter.ts b/src/client/util/DropConverter.ts
index 3e2cc6a2e..ff0e19347 100644
--- a/src/client/util/DropConverter.ts
+++ b/src/client/util/DropConverter.ts
@@ -7,7 +7,7 @@ import { StrCast } from "../../new_fields/Types";
 import { Docs } from "../documents/Documents";
 import { ScriptField } from "../../new_fields/ScriptField";
 
-export function makeTemplate(doc: Doc): boolean {
+export function makeTemplate(doc: Doc, suppressTitle = false): boolean {
     const layoutDoc = doc.layout instanceof Doc && doc.layout.isTemplateField ? doc.layout : doc;
     const layout = StrCast(layoutDoc.layout).match(/fieldKey={'[^']*'}/)![0];
     const fieldKey = layout.replace("fieldKey={'", "").replace(/'}$/, "");
@@ -16,7 +16,7 @@ export function makeTemplate(doc: Doc): boolean {
     docs.forEach(d => {
         if (!StrCast(d.title).startsWith("-")) {
             any = true;
-            Doc.MakeMetadataFieldTemplate(d, Doc.GetProto(layoutDoc));
+            Doc.MakeMetadataFieldTemplate(d, Doc.GetProto(layoutDoc), suppressTitle);
         } else if (d.type === DocumentType.COL) {
             any = makeTemplate(d) || any;
         }
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!);
diff --git a/src/scraping/buxton/scraper.py b/src/scraping/buxton/scraper.py
index 15b5844f7..998c7617d 100644
--- a/src/scraping/buxton/scraper.py
+++ b/src/scraping/buxton/scraper.py
@@ -100,9 +100,9 @@ def write_collection(parse_results, display_fields, storage_key, viewType):
     fields[storage_key] = listify(proxify_guids(view_guids))
     fields["schemaColumns"] = listify(display_fields)
     fields["backgroundColor"] = "white"
-    fields["scale"] = 0.5
     fields["viewType"] = 2
     fields["author"] = "Bill Buxton"
+    fielsd["disableLOD"] = True,
     fields["creationDate"] = {
         "date": datetime.datetime.utcnow().microsecond,
         "__type": "date"
-- 
cgit v1.2.3-70-g09d2

