Template:UI/upcoming events featured/card

From Miniscope
Jump to: navigation, search

Card-rendering sub-template for Template:UI/upcoming_events_featured. Normally invoked indirectly via that template's format=template auto-query, which passes the matched workshop's full title in as Page.

Can also be called directly for one-off main-page features that need to override the auto-pick (e.g. promoting a specific workshop ahead of its application-close timing):

All other fields are derived from the page's SMW data via per-call #show against {{{Page}}}:

  • Eyebrow?Has start date#ISO, formatted via
 May 2026 → "July 2026". CSS uppercases the visual
 rendering. ISO format-hint normalizes locale variation (LOCL would
 give "12 July 2026" which #time can parse but is locale-fragile).
 Suppressed when Has start date is empty (#time on an empty input
 returns today's month/year — the wrong default for an upcoming-event
 kicker).
  • TitlePage, wrapped in a wikilink
 to the workshop page.
  • Tagline?Has description on the page.
 Suppressed when empty.
  • Image?Has card image, falling back to
 ?Has banner. 4:3 aspect locked by CSS; uploads of a
 different ratio center-crop. When both properties are empty the
 image slot is suppressed and the card renders text-only.

CTA buttons

Auto-derived for the auto-pick path; both render only when their target is set, so a workshop with no registration URL still shows "Learn more" without a broken "Apply now":

  • Primary "Apply now"?Has registration url.
 Suppressed when unset.
  • Secondary "Learn more" → the workshop page itself
 ({{{Page}}}). Always renders when Page is non-empty.

Why not project these via the outer #ask in Template:UI/upcoming_events_featured: keeping them as #show calls here means the direct-invocation path (passing Page explicitly) works without changing the call site. The cost is one extra #show per render; the featured card is a single instance per main page, so the overhead is negligible.

Named args

  • Page — bare full title of the workshop (required from
 #ask via mainlabel=Page; required from direct callers).
 When empty the template renders nothing — the empty-state placeholder
 lives on the dispatcher side so it shows up only when the auto-query
 returned zero matches, not when this sub-template happens to receive
 an empty Page (which would only happen via a malformed call).