aboutsummaryrefslogtreecommitdiff
path: root/src/server/authentication/models/current_user_utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/authentication/models/current_user_utils.ts')
-rw-r--r--src/server/authentication/models/current_user_utils.ts44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts
index 627f3b324..5535f4bcf 100644
--- a/src/server/authentication/models/current_user_utils.ts
+++ b/src/server/authentication/models/current_user_utils.ts
@@ -83,23 +83,35 @@ export class CurrentUserUtils {
}
if (doc["template-button-detail"] === undefined) {
- const { TextDocument, ImageDocument, MasonryDocument, StackingDocument, CarouselDocument, TreeDocument } = Docs.Create;
- const detailedTemplate = `{ "doc": { "type": "doc", "content": [ { "type": "paragraph", "content": [ { "type": "dashField", "attrs": { "fieldKey": "year" } } ] }, { "type": "paragraph", "content": [ { "type": "dashField", "attrs": { "fieldKey": "company" } } ] } ] }, "selection":{"type":"text","anchor":1,"head":1},"storedMarks":[] }`;
-
- const textDoc1 = TextDocument("", { title: "shortDescription", treeViewOpen: true, treeViewExpandedView: "layout", _height: 50 });
- const textDoc2 = TextDocument("", { title: "longDescription", treeViewOpen: false, treeViewExpandedView: "layout", _height: 350 });
- const detailView = Docs.Create.StackingDocument([
- CarouselDocument([], { title: "data", _height: 350, _itemIndex: 0, backgroundColor: "#9b9b9b3F" }),
- MasonryDocument([
- textDoc1,
- textDoc2,
- // TreeDocument([], { title: "narratives", _height: 75, treeViewHideTitle: true }),
- ], { title: "stuff", _height: 300, _xMargin: 0, _autoHeight: true, columnWidth: -1, _chromeStatus: "disabled", treeViewHideTitle: true, _pivotField: "title" })
- ], { _chromeStatus: "disabled", _width: 300, _autoHeight: true, _xMargin: 0, _fontFamily: "Comic Sans MS", _fontSize: 12, title: "detailView" });
- textDoc1.text = new RichTextField(detailedTemplate, "year company");
+ const { TextDocument, MasonryDocument, CarouselDocument } = Docs.Create;
+
+ const carousel = CarouselDocument([], { title: "data", _height: 350, _itemIndex: 0, backgroundColor: "#9b9b9b3F" });
+
+ const short = TextDocument("", { title: "shortDescription", treeViewOpen: true, treeViewExpandedView: "layout", _height: 50 });
+ const long = TextDocument("", { title: "longDescription", treeViewOpen: false, treeViewExpandedView: "layout", _height: 350 });
+ short.title = "A Short Description";
+ long.title = "Long Description";
+
+ const shared = { _chromeStatus: "disabled", _autoHeight: true, _xMargin: 0 };
+ const detailViewOpts = { title: "detailView", _width: 300, _fontFamily: "Arial", _fontSize: 12 };
+ const descriptionWrapperOpts = { title: "descriptions", _height: 300, columnWidth: -1, treeViewHideTitle: true, _pivotField: "title" };
+
+ const descriptionWrapper = MasonryDocument([short, long], { ...shared, ...descriptionWrapperOpts });
+ const detailView = Docs.Create.StackingDocument([carousel, descriptionWrapper], { ...shared, ...detailViewOpts });
detailView.isTemplateDoc = makeTemplate(detailView);
- textDoc1.title = "A Short Description";
- textDoc2.title = "Long Description";
+
+ const buxtonFieldKeys = ["year", "originalPrice", "degreesOfFreedom", "company", "attribute", "primaryKey", "secondaryKey", "dimensions"];
+ const detailedTemplate = {
+ doc: {
+ type: "doc", content: buxtonFieldKeys.map(fieldKey => ({
+ type: "paragraph",
+ content: [{ type: "dashField", attrs: { fieldKey } }]
+ }))
+ },
+ selection: { type: "text", anchor: 1, head: 1 },
+ storedMarks: []
+ };
+ short.text = new RichTextField(JSON.stringify(detailedTemplate), buxtonFieldKeys.join(" "));
doc["template-button-detail"] = CurrentUserUtils.ficon({
onDragStart: ScriptField.MakeFunction('getCopy(this.dragFactory, true)'),