aboutsummaryrefslogtreecommitdiff
path: root/module/calp/html/view
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-09-29 23:36:21 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2021-09-29 23:36:21 +0200
commit1484155c211fe8452344ffdc501e858706ecbc51 (patch)
tree64906707a13f817f2175bd9a6251ff87fb695043 /module/calp/html/view
parentAdd debug tab to HTML popups. (diff)
downloadcalp-1484155c211fe8452344ffdc501e858706ecbc51.tar.gz
calp-1484155c211fe8452344ffdc501e858706ecbc51.tar.xz
Start rework on js setup.
Diffstat (limited to 'module/calp/html/view')
-rw-r--r--module/calp/html/view/calendar.scm64
-rw-r--r--module/calp/html/view/calendar/week.scm93
2 files changed, 131 insertions, 26 deletions
diff --git a/module/calp/html/view/calendar.scm b/module/calp/html/view/calendar.scm
index 4574f517..00451984 100644
--- a/module/calp/html/view/calendar.scm
+++ b/module/calp/html/view/calendar.scm
@@ -111,12 +111,16 @@
(script (@ (defer) (src "/static/clock.js")))
(script (@ (defer) (src "/static/popup.js")))
(script (@ (defer) (src "/static/rrule.js")))
- (script (@ (defer) (src "/static/binders.js")))
+ ;; (script (@ (defer) (src "/static/binders.js")))
(script (@ (defer) (src "/static/server_connect.js")))
- (script (@ (defer) (src "/static/input_list.js")))
+ ;; (script (@ (defer) (src "/static/input_list.js")))
(script (@ (defer) (src "/static/date_time.js")))
- (script (@ (defer) (src "/static/vcal.js")))
+ ;; (script (@ (defer) (src "/static/vcal.js")))
(script (@ (defer) (src "/static/script.js")))
+ (script (@ (defer) (src "/static/globals.js")))
+
+ ;; on load
+
,(calendar-styles calendars)
,@(when (debug)
@@ -251,15 +255,15 @@
`(li (@ (class "CAL_"
,(html-attr (prop calendar 'NAME))))
(a (@ (href "/search?"
- ,((@ (web uri-query) encode-query-parameters)
- `((q . (and (date/-time<=?
- ,(current-datetime)
- (prop event 'DTSTART))
- ;; TODO this seems to miss some calendars,
- ;; I belive it's due to some setting X-WR-CALNAME,
- ;; which is only transfered /sometimes/ into NAME.
- (string=? ,(->string (prop calendar 'NAME))
- (or (prop (parent event) 'NAME) ""))))))))
+ ,((@ (web uri-query) encode-query-parameters)
+ `((q . (and (date/-time<=?
+ ,(current-datetime)
+ (prop event 'DTSTART))
+ ;; TODO this seems to miss some calendars,
+ ;; I belive it's due to some setting X-WR-CALNAME,
+ ;; which is only transfered /sometimes/ into NAME.
+ (string=? ,(->string (prop calendar 'NAME))
+ (or (prop (parent event) 'NAME) ""))))))))
,(prop calendar 'NAME))))
calendars))
(div (@ (id "calendar-dropdown-template") (class "template"))
@@ -311,17 +315,19 @@
;; it.
description: ""))))
(event (car (children cal))))
- `((div (@ (class "template event-container") (id "event-template")
- ;; Only needed to create a duration. So actual dates
- ;; dosen't matter
- (data-start "2020-01-01")
- (data-end "2020-01-02"))
- ,(caddar ; strip <a> tag
- (make-block event `((class " generated ")))))
+ `(
+ ;; (div (@ (class "template event-container") (id "event-template")
+ ;; ;; Only needed to create a duration. So actual dates
+ ;; ;; dosen't matter
+ ;; (data-start "2020-01-01")
+ ;; (data-end "2020-01-02"))
+ ;; ,(caddar ; strip <a> tag
+ ;; (make-block event `((class " generated ")))))
;; TODO merge this into the event-set, add attribute
;; for non-displaying elements.
- (div (@ (class "template") (id "popup-template"))
- ,(popup event (string-append "popup" (html-id event))))))
+ ;; (div (@ (class "template") (id "popup-template"))
+ ;; ,(popup event (string-append "popup" (html-id event))))
+ ))
;; Auto-complets when adding new fields to a component
;; Any string is however still valid.
@@ -344,4 +350,18 @@
RDATE RRULE ACTION REPEAT
TRIGGER CREATED DTSTAMP LAST-MODIFIED
SEQUENCE REQUEST-STATUS
- ))))))
+ )))
+
+ (div (@ (style "display:none !important;")
+ (id "xcal-data"))
+ ,((@ (vcomponent xcal output) ns-wrap)
+ (map (@ (vcomponent xcal output) vcomponent->sxcal)
+ (stream->list
+ (filter-sorted-stream
+ (lambda (ev)
+ ((@ (vcomponent datetime) event-overlaps?)
+ ev start-date
+ (date+ end-date (date day: 1))))
+ events))))))
+
+ ))
diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm
index 556c3d85..340db7d5 100644
--- a/module/calp/html/view/calendar/week.scm
+++ b/module/calp/html/view/calendar/week.scm
@@ -52,10 +52,95 @@
,@(for event in (stream->list
(events-between start-date end-date events))
- ((@ (calp html vcomponent ) popup) event (string-append "popup" (html-id event))))
-
- )))))
-
+ ((@ (calp html vcomponent ) popup)
+ event (string-append "popup" (html-id event))))
+
+ ))
+ ;; description in sidebar / tab of popup
+ (template (@ (id "vevent-description"))
+ ,(description-template)
+ )
+
+ ;; edit tab of popup
+ (template (@ (id "vevent-edit"))
+ ,((@ (calp html vcomponent) edit-template)))
+
+ ;; "physical" block
+ (template (@ (id "vevent-block"))
+ ,(block-template)
+ )
+
+ )))
+
+;; based on the output of fmt-single-event
+(define (description-template)
+ '(div (@ (class " eventtext summary-tab " ()))
+ (h3 ((span (@ (class "repeating")) "↺")
+ (span (@ (class "bind summary")
+ (data-property "summary"))
+ "Test")))
+ (div (div (time (@ (class "bind dtstart")
+ (data-property "dtstart")
+ (data-fmt "~L~H:~M")
+ (datetime "2021-09-29T19:56:46"))
+ "19:56")
+ "\xa0—\xa0"
+ (time (@ (class "bind dtend")
+ (data-property "dtend")
+ (data-fmt "~L~H:~M")
+ (datetime "2021-09-29T19:56:46"))
+ "20:56"))
+ (div (@ (class "fields"))
+ (div (b "Plats: ")
+ (div (@ (class "bind location")
+ (data-property "location"))
+ "Alsättersgatan 13"))
+ (div (@ (class "bind description")
+ (data-property "description"))
+ ("With a description"))
+ (div (@ (class "categories"))
+ (a (@ (class "category")
+ (href "/search/?"
+ "q=%28member%20%22test%22%20%28or%20%28prop%20event%20%28quote%20CATEGORIES%29%29%20%28quote%20%28%29%29%29%29"))
+ test))
+ (div (@ (class "rrule"))
+ "Upprepas "
+ "varje vecka"
+ ".")
+ (div (@ (class "last-modified"))
+ "Senast ändrad "
+ "2021-09-29 19:56")))))
+
+(define (block-template)
+ `(div (@ ; (id ,(html-id ev))
+ (data-calendar "unknown")
+ (class "event CAL_unknown"
+ ;; ,(when (and (prop ev 'PARTSTAT)
+ ;; (eq? 'TENTATIVE (prop ev 'PARTSTAT)))
+ ;; " tentative")
+ ;; ,(when (and (prop ev 'TRANSP)
+ ;; (eq? 'TRANSPARENT (prop ev 'TRANSP)))
+ ;; " transparent")
+ )
+ (onclick "toggle_popup('popup' + this.id)")
+ )
+ ;; Inner div to prevent overflow. Previously "overflow: none"
+ ;; was set on the surounding div, but the popup /needs/ to
+ ;; overflow (for the tabs?).
+ (div (@ (class "event-body"))
+ `(span (@ (class "repeating")) ; "↺"
+ )
+ (span (@ (class "bind summary")
+ (data-property "summary"))
+ ; ,(format-summary ev (prop ev 'SUMMARY))
+ )
+ `(span (@ (class "bind location")
+ (data-property "location")))
+ ;; Document symbol when we have text
+ `(span (@ (class "description"))
+ ; "🗎"
+ ))
+ ) )
(define (time-marker-div)