aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/CollectionPivotView.tsx5
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx29
2 files changed, 20 insertions, 14 deletions
diff --git a/src/client/views/collections/CollectionPivotView.tsx b/src/client/views/collections/CollectionPivotView.tsx
index 07ad5683c..816939a41 100644
--- a/src/client/views/collections/CollectionPivotView.tsx
+++ b/src/client/views/collections/CollectionPivotView.tsx
@@ -43,8 +43,9 @@ export class CollectionPivotView extends CollectionSubView(doc => doc) {
(childDetailed) =>
DocCastAsync(childDetailed).then(childDetailed => {
if (childDetailed instanceof Doc) {
- let captured: { [name: string]: Field } = {};
- captured["childDetailed"] = new PrefetchProxy(childDetailed);
+ const targetKey = "childDetailed";
+ const captured: { [name: string]: Field } = {};
+ captured[targetKey] = new PrefetchProxy(childDetailed);
const openDocText = "const alias = getAlias(this); Doc.ApplyTemplateTo(childDetailed, alias, 'layout_detailed'); useRightSplit(alias); ";
const openDocScript = CompileScript(openDocText, {
params: { this: Doc.name, heading: "boolean", context: Doc.name },
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 3a208038c..4a6dffc1c 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -634,22 +634,27 @@ export class CollectionTreeView extends CollectionSubView(Document) {
}
ContextMenu.Instance.addItem({
description: "Buxton Layout", icon: "eye", event: () => {
- const { TextDocument, ImageDocument } = Docs.Create;
+ const { TextDocument, ImageDocument, MulticolumnDocument } = Docs.Create;
+ const { Document } = this.props;
+ const fallback = "http://www.cs.brown.edu/~bcz/face.gif";
const wrapper = Docs.Create.StackingDocument([
- ImageDocument("http://www.cs.brown.edu/~bcz/face.gif", { title: "hero" }),
+ ImageDocument(fallback, { title: "hero" }),
+ MulticolumnDocument([], { title: "data", height: 100 }),
...["short_description", "year", "company", "degrees_of_freedom"].map(key => TextDocument({ title: key }))
], { autoHeight: true, chromeStatus: "disabled" });
wrapper.disableLOD = true;
- makeTemplate(wrapper, true);
- const detailedLayout = Doc.MakeAlias(wrapper);
- const cardLayout = ImageBox.LayoutString("hero");
- this.childLayoutPairs.forEach(({ layout }) => {
- const proto = Doc.GetProto(layout);
- proto.layout = cardLayout;
- proto.layout_detailed = detailedLayout;
- layout.showTitle = "title";
- layout.showTitleHover = "titlehover";
- });
+ wrapper.isTemplateDoc = makeTemplate(wrapper, true);
+
+ const cardLayout = ImageDocument(fallback);
+ const proto = Doc.GetProto(cardLayout);
+ proto.layout = ImageBox.LayoutString("hero");
+ cardLayout.showTitle = "title";
+ cardLayout.showTitleHover = "titlehover";
+ cardLayout.isTemplateField = true; // make this document act like a template field
+ cardLayout.isTemplateDoc = true; // but it's also a template doc itself... a little weird
+
+ Document.childLayout = cardLayout;
+ Document.childDetailed = wrapper;
}
});
const existingOnClick = ContextMenu.Instance.findByDescription("OnClick...");