Template:UI/upcoming events list/row

From Miniscope
Jump to: navigation, search

Per-row renderer for Template:UI/upcoming_events_list. Do not transclude directly outside the list.

Invoked via SMW format=template with named args=yes and link=none, so page-typed projections (Page, Location) arrive as bare strings and we link them ourselves.

Named-arg params (from the outer #ask):

  • Page — bare full title of the event page (mainlabel=Page).
 Linked manually below as the row title; the per-row "Details →"
 action chip also links here.
  • StartISO?Has start date#ISO. ISO date
 string (e.g. 2026-07-12T10:00:00) parsed by
 #time for display. ISO chosen over LOCL because LOCL
 output is locale-dependent and harder to format consistently across
 wikis; ISO is unambiguous, and #time handles the
 rendering.
  • EndISO?Has end date#ISO. Optional; when
 set AND its calendar date differs from StartISO's, the date span
 renders as a range "Jul 12 – Jul 14".
  • Location?Has location. Page-typed
 multi-value (Category:Location); SMW comma-joins multiple values into
 a single string. With link=none we get bare names, then
 the location span renders them as plain text (no manual linking — a
 location like "Online" or "Boston, MA" reads fine as text, and
 inlining a wikilink in a meta line makes the row visually busy).
  • Type?Has event type. Currently unused in
 the row render (the visual identity comes from the row's date+
 location meta and the "Details →" affordance); kept on the wire so
 future variants can add a per-type chip without re-projecting.

Date / time / location meta line

Built from three optional spans separated by middots via CSS ::after (same idiom as the activity feed's meta row):

  1. Date span — always rendered when StartISO is non-empty.
 Format: May 12 → "Jul 12".
 If EndISO is set AND end's calendar date differs from start's,
 appends " – Error: Invalid time." inside the same span
 (so the range doesn't break across middots).
  1. Time span — rendered when StartISO's H:i is non-zero AND no
 multi-day end date is set. Same-day events show a time; multi-day
 events suppress it (the date range carries the temporal info, and
 "Jul 12 – Jul 14 · 09:00 AM" reads as "starts at 9am on the 12th"
 which is informative but visually crowded; the cleaner cut is
 date-range OR time, not both).
 21:17 on midnight returns "00:00"; we treat
 midnight as "no time set" (a reasonable default — events scheduled
 for exactly 00:00:00 are uncommon, and labki-datetime initializes
 unset time fields to midnight).
  1. Location span — rendered when Location is non-empty.

The CSS .wiki-events-row-meta > span:not(:last-child)::after inserts " · " between spans, so if one is suppressed the others still read cleanly without dangling middots.

Same-day vs different-day comparison

SMW's ISO projection returns full datetime strings like 2026-07-12T10:00:00. We compare calendar dates by running 2026-05-12 on each ISO value first — this normalizes both to date-only strings ("2026-07-12") that can be compared with #ifeq. Comparing raw ISO strings directly would treat "2026-07-12T10:00" and "2026-07-12T14:00" as different days, breaking the same-day detection.

Action chip

"Details →" outline button on the right of the row, linking to the event page itself. Uses [[|]] for visual consistency with other outline buttons across the schema; the chip is small (CSS shrinks the button's padding for this context) so the rows stay compact.

Per-row chip-button as a wikilink-wrapped span — not an inline [wiki-link Label] — because UI/button already encapsulates the link-vs-url-vs-styling decision, and inlining duplicates the choice. The cost is one sub-template call per row (acceptable; rows are usually limit=4 on a main page).