aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-15 01:39:46 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-15 01:39:46 +0100
commite8216ceb2cb5c61ef6fd6d6f6c9151511d01d8e9 (patch)
tree4d8074e90507198fea5da6f28323d5a70ffa9e8d
parentFix calendar for popup. (diff)
downloadcalp-e8216ceb2cb5c61ef6fd6d6f6c9151511d01d8e9.tar.gz
calp-e8216ceb2cb5c61ef6fd6d6f6c9151511d01d8e9.tar.xz
Propagate default-calendar from backend to frontend.
-rw-r--r--module/calp/html/view/calendar.scm9
-rw-r--r--static/event-creator.ts2
-rw-r--r--static/globals.ts1
3 files changed, 10 insertions, 2 deletions
diff --git a/module/calp/html/view/calendar.scm b/module/calp/html/view/calendar.scm
index 580d721e..64ee1c7c 100644
--- a/module/calp/html/view/calendar.scm
+++ b/module/calp/html/view/calendar.scm
@@ -94,7 +94,14 @@
(meta (@ (name end-time)
(content ,(date->string (date+ end-date (date day: 1)) "~s"))))
- (script "EDIT_MODE=" ,(if (edit-mode) "true" "false") ";")
+ (script
+ ,(format #f
+ "
+EDIT_MODE=~:[false~;true~];
+window.default_calendar='~a';"
+ (edit-mode)
+ (base64encode (get-config 'default-calendar))))
+
(style ,(format #f "html {
--editmode: 1.0;
diff --git a/static/event-creator.ts b/static/event-creator.ts
index 74ba4235..97ffbd62 100644
--- a/static/event-creator.ts
+++ b/static/event-creator.ts
@@ -67,7 +67,7 @@ class EventCreator {
that.ev = new VEvent();
that.ev.setProperty('summary', 'Created Event');
that.ev.setProperty('uid', uuid())
- that.ev.calendar = btoa('Calendar');
+ that.ev.calendar = window.default_calendar;
// let ev_block = document.createElement('vevent-block') as ComponentBlock;
let ev_block = new ComponentBlock(that.ev.getProperty('uid'));
diff --git a/static/globals.ts b/static/globals.ts
index 7ccfb3d2..6b689697 100644
--- a/static/globals.ts
+++ b/static/globals.ts
@@ -15,6 +15,7 @@ declare global {
vcal_objects: Map<uid, VEvent>;
VIEW: 'month' | 'week';
EDIT_MODE: boolean;
+ default_calendar: string;
}
}
window.vcal_objects = vcal_objects;