aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2020-01-20 12:19:40 -0500
committerSam Wilkins <samwilkins333@gmail.com>2020-01-20 12:19:40 -0500
commitcdde5624bac14ba6e0520a2d30d8d3926f2cc27f (patch)
treea47ce96d2d25f2476526ec49e5a53cd7e21cb7f8 /src
parent48e4149457f1075748397d4804db9e0c198b5e2e (diff)
buxton layout improvements
Diffstat (limited to 'src')
-rw-r--r--src/client/util/DropConverter.ts4
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx30
-rw-r--r--src/scraping/buxton/scraper.py2
3 files changed, 21 insertions, 15 deletions
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"