Template:Category/Workshop/header

From Miniscope
Jump to: navigation, search

Shared header block used by Template:Category/Workshop (public landing) and Template:Category/Workshop internal hub (participant- only hub inside the Lockdown'd namespace). Renders, top to bottom:

  • Banner with overlay text — Has banner (3:1 hero strip);
 falls back to Has card image (4:3) when Has banner is unset. The
 workshop name + dates + location overlay the bottom of the image
 with a dark gradient for legibility. Same visual idiom as
 Template:UI/hero's background variant; not using UI/hero
 directly because its negative-margin breakout is keyed to the
 Main Page Common.css overrides that don't apply on workshop pages.
 When both image properties are empty, the banner block is replaced
 by a plain meta line so the dates/location still surface.
  • Status block — date-aware big colored heading + an Apply CTA
 in apps_open state, or a small Participant hub link in apps_closed
 / happening / past states. Whole block tints to the state's color
 for at-a-glance status visibility (replaces the smaller-pill chip
 treatment from the first cut).

State machine

In priority order (first match wins):

  1. cancelled — Has event status == Cancelled
  2. postponed — Has event status == Postponed
  3. past — today > end_date + 1 day (end-of-day inclusive)
  4. happening — today >= start_date (workshop has begun
 and the "past" arm above didn't match, so we're still inside or
 before the end)
  1. apps_closed — today > close_date + 1 day
  2. apps_open — today >= open_date
  3. apps_pending — fall-through; renders "Applications
 opening soon"

CTA visibility per state (public mode)

State Apply now Participant hub →
apps_pending hide hide
apps_open show (prominent) hide
apps_closed hide show (small, .hero-btn-user)
happening hide show (small, .hero-btn-user)
past hide show (small, .hero-btn-user)
cancelled hide hide
postponed hide hide

When suppress_ctas=1 is passed, all CTAs hide regardless of state. The internal hub uses this to keep its header informational-only (participants are already inside the hub, so the hub link is redundant and the apply button is irrelevant).

Sentinel defaults for missing dates

Each date #show is wrapped in an #if that substitutes 2099-12-31 when the property is unset. This makes the cascade fall through cleanly: a workshop with no application dates defaults to apps_pending rather than accidentally matching an open-window arm against an "empty" date string (which #time:U would otherwise interpret as today).

The +1 day modifier on end_date and close_date treats the named day as inclusive of its full 24 hours — "applications close May 22" means apps are still open during May 22 and closed starting May 23.

Why a shared sub-template

The state machine + banner overlay + status styling is ~50 lines of non-trivial wikitext + CSS, and both the public workshop page and the internal hub need an identical version. Extracting here keeps the logic in one place; the two callers become thin shells around the unique sections each adds.

Params

  • workshop — full title of the workshop record page.
 Required.
 * Public Workshop page: Template:Category/Workshop/header
 * Internal hub: 
  • suppress_ctas — truthy value drops all CTA buttons
 (Apply now AND Participant hub). The internal hub passes this;
 the public page doesn't.

Participant hub button gating

Wrapped in <span class="hero-btn-user"> so it's hidden for anonymous viewers and visible only for logged-in users — relies on the Tweeki body.tweeki-user-anon body class and the .hero-btn-anon/.hero-btn-user visibility rules documented as a MediaWiki:Common.css dependency by Template:UI/hero.