aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-08-26 10:59:56 -0400
committerbobzel <zzzman@gmail.com>2024-08-26 10:59:56 -0400
commit6bc79c5dfc5f61bf5d1b1544d399703c8006b898 (patch)
treea9695a7eb6650be542a83e009667ce5e04e33d34 /src
parenta52cda0a098716c24b3c6aafe23d2bd9267c72d9 (diff)
cleanup of myXXXstuff on dashboards
Diffstat (limited to 'src')
-rw-r--r--src/client/views/DashboardView.tsx5
-rw-r--r--src/client/views/TagsView.tsx6
-rw-r--r--src/fields/Doc.ts8
3 files changed, 8 insertions, 11 deletions
diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx
index dcc5442f0..f4fc8ee9f 100644
--- a/src/client/views/DashboardView.tsx
+++ b/src/client/views/DashboardView.tsx
@@ -429,7 +429,8 @@ export class DashboardView extends ObservableReactComponent<object> {
dashboardDoc.pane_count = 1;
freeformDoc.embedContainer = dashboardDoc;
dashboardDoc.myOverlayDocs = new List<Doc>();
- dashboardDoc.myPublishedDocs = new List<Doc>();
+ dashboardDoc[DocData].myPublishedDocs = new List<Doc>();
+ dashboardDoc[DocData].myTagCollections = new List<Doc>();
Doc.AddDocToList(Doc.MyDashboards, 'data', dashboardDoc);
@@ -467,7 +468,7 @@ export class DashboardView extends ObservableReactComponent<object> {
};
const myCalendars = DocUtils.AssignScripts(Docs.Create.CalendarCollectionDocument([], reqdOpts));
// { treeView_ChildDoubleClick: 'openPresentation(documentView.rootDoc)' }
- dashboardDoc.myCalendars = new PrefetchProxy(myCalendars);
+ dashboardDoc[DocData].myCalendars = new PrefetchProxy(myCalendars);
}
public static SetupDashboardTrails(dashboardDoc: Doc) {
diff --git a/src/client/views/TagsView.tsx b/src/client/views/TagsView.tsx
index dffd1e096..394162f46 100644
--- a/src/client/views/TagsView.tsx
+++ b/src/client/views/TagsView.tsx
@@ -70,11 +70,7 @@ export class TagItem extends ObservableReactComponent<TagItemProps> {
newTagCol.title = tag;
newTagCol.collections = new List<Doc>();
newTagCol[DocData].docs = new List<Doc>();
- // If the active Dashboard does not have a tag Doc collection, create it.
- if (Doc.ActiveDashboard) {
- if (!Doc.ActiveDashboard.myTagCollections) Doc.ActiveDashboard.myTagCollections = new List<Doc>();
- Doc.AddDocToList(Doc.ActiveDashboard, 'myTagCollections', newTagCol);
- }
+ Doc.ActiveDashboard && Doc.AddDocToList(Doc.ActiveDashboard, 'myTagCollections', newTagCol);
return newTagCol;
};
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index ffb5aab79..e3178f20c 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -258,16 +258,16 @@ export class Doc extends RefField {
public static set ActiveDashboard(val: Opt<Doc>) { Doc.UserDoc().activeDashboard = val; } // prettier-ignore
public static IsInMyOverlay(doc: Doc) { return Doc.MyOverlayDocs.includes(doc); } // prettier-ignore
- public static AddToMyOverlay(doc: Doc) { return Doc.ActiveDashboard?.myOverlayDocs ? Doc.AddDocToList(Doc.ActiveDashboard, 'myOverlayDocs', doc) : Doc.AddDocToList(DocCast(Doc.UserDoc().myOverlayDocs), undefined, doc); } // prettier-ignore
- public static RemFromMyOverlay(doc: Doc) { return Doc.ActiveDashboard?.myOverlayDocs ? Doc.RemoveDocFromList(Doc.ActiveDashboard,'myOverlayDocs', doc) : Doc.RemoveDocFromList(DocCast(Doc.UserDoc().myOverlayDocs), undefined, doc); } // prettier-ignore
+ public static AddToMyOverlay(doc: Doc) { return Doc.ActiveDashboard ? Doc.AddDocToList(Doc.ActiveDashboard, 'myOverlayDocs', doc) : Doc.AddDocToList(DocCast(Doc.UserDoc().myOverlayDocs), undefined, doc); } // prettier-ignore
+ public static RemFromMyOverlay(doc: Doc) { return Doc.ActiveDashboard ? Doc.RemoveDocFromList(Doc.ActiveDashboard,'myOverlayDocs', doc) : Doc.RemoveDocFromList(DocCast(Doc.UserDoc().myOverlayDocs), undefined, doc); } // prettier-ignore
public static AddToMyPublished(doc: Doc) {
doc[DocData].title_custom = true;
doc[DocData].layout_showTitle = 'title';
- Doc.ActiveDashboard?.myPublishedDocs ? Doc.AddDocToList(Doc.ActiveDashboard, 'myPublishedDocs', doc) : Doc.AddDocToList(DocCast(Doc.UserDoc().myPublishedDocs), undefined, doc); } // prettier-ignore
+ Doc.ActiveDashboard ? Doc.AddDocToList(Doc.ActiveDashboard, 'myPublishedDocs', doc) : Doc.AddDocToList(DocCast(Doc.UserDoc().myPublishedDocs), undefined, doc); } // prettier-ignore
public static RemFromMyPublished(doc: Doc){
doc[DocData].title_custom = false;
doc[DocData].layout_showTitle = undefined;
- Doc.ActiveDashboard?.myPublishedDocs ? Doc.RemoveDocFromList(Doc.ActiveDashboard,'myPublishedDocs', doc) : Doc.RemoveDocFromList(DocCast(Doc.UserDoc().myPublishedDocs), undefined, doc); } // prettier-ignore
+ Doc.ActiveDashboard ? Doc.RemoveDocFromList(Doc.ActiveDashboard,'myPublishedDocs', doc) : Doc.RemoveDocFromList(DocCast(Doc.UserDoc().myPublishedDocs), undefined, doc); } // prettier-ignore
public static IsComicStyle(doc?: Doc) { return doc && Doc.ActiveDashboard && !Doc.IsSystem(doc) && Doc.UserDoc().renderStyle === 'comic' ; } // prettier-ignore
constructor(id?: FieldId, forceSave?: boolean) {