Template:Category/Dashboard/sub dashboard card

From Miniscope
Jump to: navigation, search

Row renderer for the sub-dashboard KPI grid in the Category:Dashboard display template (Template:Category/Dashboard).

Invoked via SMW's format=template with named args=yes and link=none (so positional arg {{{1}}} is the bare page name, not a wikilink).

Emits a single clickable KPI card per child dashboard. The markup is inlined here (rather than calling Template:UI/kpi_card) because some SMW configurations don't transclude nested templates reliably from inside a format=template row template.

Card structure mirrors Template:UI/kpi_card's linked variant: <div class="wiki-kpi-card wiki-kpi-card-link">…</div>.

  • Value — count of entries in the child's Has focus category,
 if set. Otherwise an em-dash.
  • Label — the leaf segment of the dashboard's page name (so
 Dashboard/Knowledge overview renders as Knowledge overview).
  • Link — the dashboard page itself; the whole card is clickable.

Named args:

  • — the dashboard page (named arg, from SMW's mainlabel=Page; bare name when called with link=none). Falls back to positional for direct template invocations like {{Category/Dashboard/sub_dashboard_card|1=Dashboard/Foo|Focus=Category:Foo}}.
  • Focus — value of ?Has focus category=Focus. With link=none on the parent query, this comes through as the canonical full title including the namespace prefix (e.g. Category:Submission). Used directly in the count query as [[{{{Focus}}}]]do not prepend another Category:.
  • Description — value of ?Has description=Description (currently unused; kept for future tooltip use)

Why the named-arg detour: with format=template + named args=yes + link=none, SMW silently fails to populate {{{1}}} with the subject — it expects the subject to be reached by its mainlabel. Setting mainlabel=Page on the parent #ask exposes the page under {{{Page}}}.