aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-26 17:53:32 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-26 17:53:32 +0100
commit4b9fa491fa44c6a4df803b49e4987a03bdc71a0a (patch)
tree4e53ac538a1397e91ed1931515835416b7b93216
parentMade vevent-dl prettier. (diff)
downloadcalp-4b9fa491fa44c6a4df803b49e4987a03bdc71a0a.tar.gz
calp-4b9fa491fa44c6a4df803b49e4987a03bdc71a0a.tar.xz
Display categories in event description.
-rw-r--r--module/calp/html/view/calendar/week.scm17
-rw-r--r--static/components/vevent-description.ts22
-rw-r--r--static/style.scss12
3 files changed, 40 insertions, 11 deletions
diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm
index b228991b..1fbe4dbe 100644
--- a/module/calp/html/view/calendar/week.scm
+++ b/module/calp/html/view/calendar/week.scm
@@ -235,9 +235,9 @@
'(div (@ (class " vevent eventtext summary-tab " ()))
(h3 ((span (@ (class "repeating")) ; "↺"
)
- (span (@ (class "bind summary")
+ (span (@ (class "summary")
(data-property "summary")))))
- (div (div (time (@ (class "bind dtstart")
+ (div (div (time (@ (class "dtstart")
(data-property "dtstart")
(data-fmt "~L~H:~M")
(datetime ; "2021-09-29T19:56:46"
@@ -245,7 +245,7 @@
; "19:56"
)
"\xa0—\xa0"
- (time (@ (class "bind dtend")
+ (time (@ (class "dtend")
(data-property "dtend")
(data-fmt "~L~H:~M")
(datetime ; "2021-09-29T19:56:46"
@@ -254,14 +254,17 @@
))
(div (@ (class "fields"))
(div (b "Plats: ")
- (div (@ (class "bind location")
+ (div (@ (class "location")
(data-property "location"))
; "Alsättersgatan 13"
))
- (div (@ (class "bind description")
+ (div (@ (class "description")
(data-property "description"))
; "With a description"
)
+
+ (div (@ (class "categories")
+ (data-property "categories")))
;; (div (@ (class "categories"))
;; (a (@ (class "category")
;; (href "/search/?"
@@ -296,11 +299,11 @@
(div (@ (class "event-body"))
(span (@ (class "repeating")) ; "↺"
)
- (span (@ (class "bind summary")
+ (span (@ (class "summary")
(data-property "summary"))
; ,(format-summary ev (prop ev 'SUMMARY))
)
- (span (@ (class "bind location")
+ (span (@ (class "location")
(data-property "location")))
;; Document symbol when we have text
(span (@ (class "description"))
diff --git a/static/components/vevent-description.ts b/static/components/vevent-description.ts
index 03c5355d..b1605d50 100644
--- a/static/components/vevent-description.ts
+++ b/static/components/vevent-description.ts
@@ -2,6 +2,7 @@ export { ComponentDescription }
import { VEvent } from '../vevent'
import { ComponentVEvent } from './vevent'
+import { makeElement } from '../lib'
/*
<vevent-description />
@@ -21,10 +22,23 @@ class ComponentDescription extends ComponentVEvent {
let p = el.dataset.property!;
let d, fmt;
if ((d = data.getProperty(p))) {
- if ((fmt = el.dataset.fmt)) {
- el.textContent = d.format(fmt);
- } else {
- el.textContent = d;
+ switch (p.toLowerCase()) {
+ case 'categories':
+ for (let item of d) {
+ let q = encodeURIComponent(
+ `(member "${item}" (or (prop event (quote CATEGORIES)) (quote ())))`)
+ el.appendChild(makeElement('a', {
+ textContent: item,
+ href: `/search/?q=${q}`,
+ }))
+ }
+ break;
+ default:
+ if ((fmt = el.dataset.fmt)) {
+ el.textContent = d.format(fmt);
+ } else {
+ el.textContent = d;
+ }
}
}
}
diff --git a/static/style.scss b/static/style.scss
index b887999b..bd29f4cc 100644
--- a/static/style.scss
+++ b/static/style.scss
@@ -662,6 +662,18 @@ vevent-block, .event {
color: $gray;
padding-right: 1em;
}
+
+ .categories > a::after {
+ content: ","
+ }
+
+ .categories > a:last-child::after {
+ content: ""
+ }
+
+ .categories > a {
+ margin-right: 1ch;
+ }
}
.attach {