Template:UI/projects library/entry

From Miniscope
Jump to: navigation, search

Card partial for Template:UI/projects_library. Invoked via SMW format=template with named args=yes, so each call receives the project's title in {{{Page}}} plus any extra projected printouts as named args.

Args:

  • Page — full title of the project page (from the
 parent #ask's mainlabel=Page).
  • Status — projected from ?Has project status;
 passes through as text (the property is an enum, single-valued).
  • Description — projected from ?Has description;
 may run from one sentence to a full paragraph but is line-clamped
 to 3 lines on the card to keep card heights uniform. The full
 description still renders on the project page's masthead.
  • Image — projected from ?Has card image;
 optional. When empty, the card image area falls back to a
 status-keyed gradient block (see styles.css), so cards without
 imagery still render cleanly in the grid.

Counts of related content are computed inline via per-card #ask calls against the reverse relationship {{{Page}}}. Only Guides and FAQs surface as count chips — the other Has-project content types (Publications, Workshops, SOPs) are accessible from the per- project masthead but aren't directory-level navigation hooks.

Why inline #ask rather than projecting through the parent #ask: SMW's format=template projections give per-row values of properties ON the project page itself, not REVERSE-relationship counts. There's no #ask printout syntax for "number of pages that link to this row's page via property X", so the count has to be a separate #ask.

Status-keyed image fallback: when no Image is set, the image area renders as a flat div with a status-keyed class (...-image-fallback-active, etc.) so styles.css can apply a gradient that matches the chip palette. Same status keys as the chip (active / maintained / development / planned / deprecated / cancelled / other), normalized via the same lowercase

  1. switch as the status chip. The #switch is repeated inline at each

class binding because the Variables extension isn't enabled on the target wikis — re-evaluating the same switch is cheap (literal string match) and keeps the template self-contained.