From 608e4739ac68302122a181814a8d7f548a42facb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 6 Jul 2020 01:07:14 +0200 Subject: Introduce HTML edit mode. --- module/output/html.scm | 52 +++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 20 deletions(-) (limited to 'module/output/html.scm') diff --git a/module/output/html.scm b/module/output/html.scm index 6d2706ce..4947594a 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -31,11 +31,18 @@ pre: (ensure procedure?)) (define debug (make-parameter #f)) - (define-config debug #f "Places the generated thingy in debug mode" post: debug) + +;;; NOTE edit mode should preferably depend on login-status of the user +;;; but this works for the time being. +(define edit-mode (make-parameter #t)) +(define-config edit-mode #t + "Makes the document editable" + post: edit-mode) + (define* (slider-input key: variable (min 0) (max 10) @@ -214,8 +221,9 @@ ;; The calc's here is to enable an "edit-mode". ;; Setting --editmode ≈ 0.8 gives some whitespace to the right ;; of the events, alowing draging there for creating new events. - ;; TODO only include var and calc when editing should be enabled. - (format #f "left:calc(var(--editmode)*~,3f%);width:calc(var(--editmode)*~,3f%);top:~,3f%;height:~,3f%;" + (format #f (if (edit-mode) + "left:calc(var(--editmode)*~,3f%);width:calc(var(--editmode)*~,3f%);top:~,3f%;height:~,3f%;" + "left:~,3f%;width:~,3f%;top:~,3f%;height:~,3f%;") (* 100 (x-pos ev)) ; left (* 100 (width ev)) ; width @@ -714,25 +722,29 @@ (div (@ (style "grid-area: details")) - ,(when (debug) + ,(when (or (debug) (edit-mode)) `(details (@ (class "sliders")) (summary "Option sliders") - (label "Event blankspace") - ,(slider-input - variable: "editmode" - min: 0 - max: 1 - step: 0.01 - value: 1) - - (label "Fontsize") - ,(slider-input - unit: "pt" - min: 1 - max: 20 - step: 1 - value: 8 - variable: "event-font-size"))) + + + ,@(when (edit-mode) + `((label "Event blankspace") + ,(slider-input + variable: "editmode" + min: 0 + max: 1 + step: 0.01 + value: 1))) + + ,@(when (debug) + `((label "Fontsize") + ,(slider-input + unit: "pt" + min: 1 + max: 20 + step: 1 + value: 8 + variable: "event-font-size"))))) ;; List of calendars (details (@ (class "calendarlist")) -- cgit v1.2.3