From e71f0c20adc4dc2f49bca99a859241fdadf376d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 30 Nov 2021 01:09:53 +0100 Subject: Rework tab system. This sepparates popup-elements from their tabbed contents, allowing clearer sepparations of concerns, along with easier adding and removing of tabs to the tabset! --- module/calp/html/view/calendar/week.scm | 73 +++++++-------------------------- 1 file changed, 15 insertions(+), 58 deletions(-) (limited to 'module/calp/html/view/calendar/week.scm') diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index 1fbe4dbe..6674b904 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -95,42 +95,6 @@ (define (popup-template) - ;; the XXX-n and YYY-n id:s aren't actually used, but mearly show how things - ;; are supposed to be linked together. - ;; Each instance of XXX should be replaced with THE SAME unique id, - ;; and each instance of YYY shoud be replaced with another, but unique id. - ;; n is a serial number, where a tab and its label MUST have the same number. - - (define* (build-tab - tabdata key: - (selected "false") - (tabindex "-1")) - `(button (@ (role "tab") - (aria-selected ,selected) - (tabindex ,tabindex) - (aria-controls "XXX-n") - (id "YYY-n") - (title ,(tab-title tabdata))) - ,(tab-label tabdata))) - - (define tabs - (append - (list - (make-tab "ร–versikt" "๐Ÿ“…" - '(vevent-description - (@ (class "vevent populate-with-uid")))) - (make-tab "Redigera" "๐Ÿ–Š" - '(vevent-edit (@ (class "populate-with-uid")))) - (make-tab "Upprepningar" "โ†บ" - '(vevent-edit-rrule (@ (class "populate-with-uid"))))) - - (when (debug) - (list - (make-tab "Debug" "๐Ÿธ" - '(vevent-dl (@ (class "populate-with-uid")))) - )))) - - ;; becomes the direct child of `(div (@ (class "popup-root window") (onclick "event.stopPropagation()")) @@ -144,28 +108,21 @@ (title "Ta Bort")) "๐Ÿ—‘")) - (main (@ (class "tabgroup window-body")) - (menu (@ (role "tablist") - (aria-label "Simple Tabs")) - ,@(cons (build-tab (car tabs) - selected: "true" - tabindex: "0") - (map build-tab (cdr tabs)))) - ;; content - (article (@ (id "XXX-n") - (role "tabpanel") - (tabindex "0") - (aria-labeledby "YYY-n")) - ,(tab-body (car tabs))) - ,@(map (lambda (tab) - `(article (@ (id "XXX-n") - (role "tabpanel") - (tabindex "0") - (hidden) - (aria-labeledby "YYY-n")) - ,(tab-body tab))) - (cdr tabs)) - ))) + (tab-group (@ (class "window-body")) + (vevent-description + (@ (data-label "๐Ÿ“…") (data-title "ร–versikt") + (class "vevent"))) + + (vevent-edit + (@ (data-label "๐Ÿ–Š") (data-title "Redigera"))) + + ;; (vevent-edit-rrule + ;; (@ (data-label "โ†บ") (data-title "Upprepningar"))) + + ,@(when (debug) + '((vevent-dl + (@ (data-label "๐Ÿธ") (data-title "Debug"))))) + ))) (define (week-day-select args) `(select (@ ,@args) -- cgit v1.2.3