diff options
-rw-r--r-- | module/output/html.scm | 24 | ||||
-rw-r--r-- | static/script.js | 4 | ||||
-rw-r--r-- | static/style.css | 7 |
3 files changed, 23 insertions, 12 deletions
diff --git a/module/output/html.scm b/module/output/html.scm index 4365270c..49a634ee 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -181,11 +181,21 @@ "som iCal")) (li (a (@ (href "/calendar/" ,(prop ev 'UID) ".xcs")) "som xCal")))))) - (when (edit-mode) + ;; Only display sxml when in debug mode. See below for other case + (when (debug) `(("</>" ,((@ (output xcal) ns-wrap) ((@ (output xcal) vcomponent->sxcal) - ev)))))))))) + ev))))))) + (div (@ (style "display:none !important;")) + ;; NOTE This can be limited to only when edit-mode is enabled but debug + ;; mode is not. That would however require a few more cases for the + ;; javascript to work. + ,(when (and (not (debug)) ; (edit-mode) + ) + ((@ (output xcal) ns-wrap) + ((@ (output xcal) vcomponent->sxcal) + ev))))))) @@ -673,6 +683,16 @@ (meta (@ (name end-time) (content ,(date->string (date+ end-date (date day: 1)) "~s")))) + (script + "EDIT_MODE=true;") + + (style ,(format #f "html { + --editmode: 1.0; + --event-font-size: 8pt; + --gray: #757575; + --btn-height: 0.5ex; +}")) + ,(include-css "/static/style.css") ,(include-alt-css "/static/dark.css" '(title "Dark")) ,(include-alt-css "/static/light.css" '(title "Light")) diff --git a/static/script.js b/static/script.js index 7397dade..d3526849 100644 --- a/static/script.js +++ b/static/script.js @@ -442,7 +442,7 @@ window.onload = function () { window.setInterval(update_current_time_bar, 1000 * 60) /* Is event creation active? */ - if (true) { + if (EDIT_MODE) { let eventCreator = new EventCreator; for (let c of document.getElementsByClassName("events")) { c.onmousedown = eventCreator.create_event_down(c); @@ -646,8 +646,6 @@ function bind_properties (el, wide_event=false) { default: lst.push([s, (s, v) => s.innerHTML = v]); } - /* TODO the icalendar data is only here when we have edit mode entabled. - Either always include it, or find the default value some other way */ el.properties["_value_" + field] = s.innerHTML; } diff --git a/static/style.css b/static/style.css index 36f1a0c3..793ed366 100644 --- a/static/style.css +++ b/static/style.css @@ -1,12 +1,5 @@ html { height: 100%; - /* TODO - * get the default values from the code. - */ - --editmode: 1.0; - --event-font-size: 8pt; - --gray: #757575; - --btn-height: 0.5ex; } html, body { |