From 41667bcfe33cb16da7cbd09b9b7d59f7e957bb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 20 Nov 2020 22:06:34 +0100 Subject: Add preliminary component for input-plus-minus. --- module/calp/html/components.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'module') diff --git a/module/calp/html/components.scm b/module/calp/html/components.scm index 03e1cef1..816975e7 100644 --- a/module/calp/html/components.scm +++ b/module/calp/html/components.scm @@ -175,3 +175,26 @@ (rel "alternate stylesheet") (href ,path) ,@extra-attributes))) + + +(define-public (input-plus-minus positive?) + (define id (gensym "id")) + `(span (@ (class "input-timespan")) + (input (@ (type "checkbox") + (style "display:none") + (class "plusminuscheck") + ,@(if positive? '((checked)) '()) + (id ,id))) + (label + (@ (for ,id)) + (span (@ (class "plus")) "+") + (span (@ (class "minus")) "-")))) + +;; (define-once timespan-generator-id (gensym "timespan-generator")) +;; (define-public (input-timespan-generator) +;; `((div (@ (class "template") +;; (id ,timespan-generator-id)) +;; ,(input-timespan)) +;; (script +;; "function make_timespan_input() {\n" +;; "return document.getElementsById(" ,timespan-generator-id ").cloneNode(true);"))) -- cgit v1.2.3