From 03dafe7743dc3e70f9e936aec8bf2e49efbfb041 Mon Sep 17 00:00:00 2001
From: bob <bcz@cs.brown.edu>
Date: Fri, 17 Jan 2020 17:09:29 -0500
Subject: changed view types around to be stored on extension doc.  added stuff
 to stackingview to create views of fields using ';"

---
 src/client/views/nodes/DocumentView.tsx | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index dabe5a7aa..60dc253f7 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -44,6 +44,7 @@ import { InkTool } from '../../../new_fields/InkField';
 import { TraceMobx } from '../../../new_fields/util';
 import { List } from '../../../new_fields/List';
 import { FormattedTextBoxComment } from './FormattedTextBoxComment';
+import { CollectionStackingView } from '../collections/CollectionStackingView';
 
 library.add(fa.faEdit, fa.faTrash, fa.faShare, fa.faDownload, fa.faExpandArrowsAlt, fa.faCompressArrowsAlt, fa.faLayerGroup, fa.faExternalLinkAlt, fa.faAlignCenter, fa.faCaretSquareRight,
     fa.faSquare, fa.faConciergeBell, fa.faWindowRestore, fa.faFolder, fa.faMapPin, fa.faLink, fa.faFingerprint, fa.faCrosshairs, fa.faDesktop, fa.faUnlock, fa.faLock, fa.faLaptopCode, fa.faMale,
@@ -551,6 +552,20 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
         }
     }
 
+    @undoBatch
+    @action
+    setNarrativeView = (custom: boolean): void => {
+        if (custom) {
+            this.props.Document.layout_narrative = CollectionView.LayoutString("narrative");
+            this.props.Document.nativeWidth = this.props.Document.nativeHeight = undefined;
+            !this.props.Document.narrative && (Doc.GetProto(this.props.Document).narrative = new List<Doc>([]));
+            this.props.Document.viewType = CollectionViewType.Stacking;
+            this.props.Document.layoutKey = "layout_narrative";
+        } else {
+            DocumentView.makeNativeViewClicked(this.props.Document)
+        }
+    }
+
     @undoBatch
     @action
     setCustomView = (custom: boolean): void => {
@@ -744,7 +759,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
         return (showTitle && !showTitleHover ? 0 : 0) + 1;
     }
 
-    @computed get finalLayoutKey() { return this.props.layoutKey || "layout"; }
+    @computed get finalLayoutKey() { return this.props.layoutKey || StrCast(this.props.Document.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 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/documents/Documents.ts                    |  4 ++++
 src/client/util/DropConverter.ts                     |  3 +--
 src/client/views/collections/CollectionPivotView.tsx |  2 +-
 src/client/views/collections/CollectionTreeView.tsx  | 17 +++++++++++++++++
 src/client/views/nodes/DocumentView.tsx              |  2 +-
 5 files changed, 24 insertions(+), 4 deletions(-)

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index c3f03aede..4fe13fa78 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -518,6 +518,10 @@ export namespace Docs {
             return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { chromeStatus: "collapsed", schemaColumns: new List([new SchemaHeaderField("title", "#f1efeb")]), ...options, viewType: CollectionViewType.Stacking });
         }
 
+        export function MulticolumnDocument(documents: Array<Doc>, options: DocumentOptions) {
+            return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { chromeStatus: "collapsed", schemaColumns: new List([new SchemaHeaderField("title", "#f1efeb")]), ...options, viewType: CollectionViewType.Multicolumn });
+        }
+
         export function MasonryDocument(documents: Array<Doc>, options: DocumentOptions) {
             return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { chromeStatus: "collapsed", schemaColumns: new List([new SchemaHeaderField("title", "#f1efeb")]), ...options, viewType: CollectionViewType.Masonry });
         }
diff --git a/src/client/util/DropConverter.ts b/src/client/util/DropConverter.ts
index dc66bceee..3e2cc6a2e 100644
--- a/src/client/util/DropConverter.ts
+++ b/src/client/util/DropConverter.ts
@@ -7,8 +7,7 @@ import { StrCast } from "../../new_fields/Types";
 import { Docs } from "../documents/Documents";
 import { ScriptField } from "../../new_fields/ScriptField";
 
-
-function makeTemplate(doc: Doc): boolean {
+export function makeTemplate(doc: Doc): 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(/'}$/, "");
diff --git a/src/client/views/collections/CollectionPivotView.tsx b/src/client/views/collections/CollectionPivotView.tsx
index 6af7cce70..02cd2e2c9 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 = 'layoutCustom'; useRightSplit(alias); ";
+            const openDocText = "const alias = getAlias(this); alias.layoutKey = 'detailedDeviceView'; 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 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" }) });
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 60dc253f7..8c7361673 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -562,7 +562,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
             this.props.Document.viewType = CollectionViewType.Stacking;
             this.props.Document.layoutKey = "layout_narrative";
         } else {
-            DocumentView.makeNativeViewClicked(this.props.Document)
+            DocumentView.makeNativeViewClicked(this.props.Document);
         }
     }
 
-- 
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/nodes/DocumentView.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

