From 9badfc489f00afd10489f0dde0a3b9e21817feb5 Mon Sep 17 00:00:00 2001 From: bobzel Date: Sat, 18 May 2024 23:15:49 -0400 Subject: more cardView cleanup --- src/client/views/global/globalScripts.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/client/views/global') diff --git a/src/client/views/global/globalScripts.ts b/src/client/views/global/globalScripts.ts index 35a3a2e31..d5f6921a2 100644 --- a/src/client/views/global/globalScripts.ts +++ b/src/client/views/global/globalScripts.ts @@ -166,44 +166,44 @@ ScriptingGlobals.add(function showFreeform( setDoc: (doc: Doc, dv: DocumentView) => doc.cardSort = "links", }], ['like', { - checkResult: (doc: Doc) => StrCast(doc?.cardSort) === "custom" && StrCast(doc?.customSortField) === "like", + checkResult: (doc: Doc) => StrCast(doc?.cardSort) === "custom" && StrCast(doc?.cardSort_customField) === "like", setDoc: (doc: Doc, dv: DocumentView) => { doc.cardSort = "custom"; - doc.customSortField = "like"; - doc.visibleGroupNumbers = new List(); + doc.cardSort_customField = "like"; + doc.cardSort_visibleSortGroups = new List(); } }], ['star', { - checkResult: (doc: Doc) => StrCast(doc?.cardSort) === "custom" && StrCast(doc?.customSortField) === "star", + checkResult: (doc: Doc) => StrCast(doc?.cardSort) === "custom" && StrCast(doc?.cardSort_customField) === "star", setDoc: (doc: Doc, dv: DocumentView) => { doc.cardSort = "custom"; - doc.customSortField = "star"; - doc.visibleGroupNumbers = new List(); + doc.cardSort_customField = "star"; + doc.cardSort_visibleSortGroups = new List(); } }], ['idea', { - checkResult: (doc: Doc) => StrCast(doc?.cardSort) === "custom" && StrCast(doc?.customSortField) === "idea", + checkResult: (doc: Doc) => StrCast(doc?.cardSort) === "custom" && StrCast(doc?.cardSort_customField) === "idea", setDoc: (doc: Doc, dv: DocumentView) => { doc.cardSort = "custom"; - doc.customSortField = "idea"; - doc.visibleGroupNumbers = new List(); + doc.cardSort_customField = "idea"; + doc.cardSort_visibleSortGroups = new List(); } }], ['chat', { - checkResult: (doc: Doc) => StrCast(doc?.cardSort) === "custom" && StrCast(doc?.customSortField) === "chat", + checkResult: (doc: Doc) => StrCast(doc?.cardSort) === "custom" && StrCast(doc?.cardSort_customField) === "chat", setDoc: (doc: Doc, dv: DocumentView) => { doc.cardSort = "custom"; - doc.customSortField = "chat"; - doc.visibleGroupNumbers = new List(); + doc.cardSort_customField = "chat"; + doc.cardSort_visibleSortGroups = new List(); }, }], ]); for (let i = 0; i < 8; i++) { map.set((i + 1 + '') as any, { - checkResult: (doc: Doc) => NumListCast(doc?.visibleGroupNumbers).includes(i), + checkResult: (doc: Doc) => NumListCast(doc?.cardSort_visibleSortGroups).includes(i), setDoc: (doc: Doc, dv: DocumentView) => { - const list = NumListCast(doc.visibleGroupNumbers); - doc.visibleGroupNumbers = new List(list.includes(i) ? list.filter(d => d !== i) : [...list, i]); + const list = NumListCast(doc.cardSort_visibleSortGroups); + doc.cardSort_visibleSortGroups = new List(list.includes(i) ? list.filter(d => d !== i) : [...list, i]); }, }); } @@ -219,7 +219,7 @@ ScriptingGlobals.add(function showFreeform( ScriptingGlobals.add(function cardHasLabel(label: string) { const selected = SelectionManager.Docs.lastElement(); const labelNum = Number(label) - 1; - return labelNum < 4 || (selected && DocListCast(selected[Doc.LayoutFieldKey(selected)]).some(doc => doc[StrCast(selected.customSortField)] == labelNum)); + return labelNum < 4 || (selected && DocListCast(selected[Doc.LayoutFieldKey(selected)]).some(doc => doc[StrCast(selected.cardSort_customField)] == labelNum)); }, ''); // ScriptingGlobals.add(function setCardSortAttr(attr: 'time' | 'docType' | 'color', value: any, checkResult?: boolean) { -- cgit v1.2.3-70-g09d2