Template:SidebarPersonBadge: Difference between revisions

From Bodhicitta
(VSCode edit)
(Space both sides of the role separator)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#ifeq:{{{ 1 | }}}|Anon||<div class="col-sm-6 col-md-12 position-relative p-3 rounded-xl" style="width: 100%;">
<includeonly>{{#ifeq:{{{ 1 | }}}|Anon||<div class="sidebar-person position-relative rounded-xl"><!--
<div class="row">
Portrait, name and roles for one person in a library-item sidebar.
<div class="col-4 col-md-12">
 
<div class="mx-auto" style="max-width: 200px;">{{#widget:SidebarPersonPageRoundImage
A horizontal row — small round avatar, then name and roles — rather than a
|filepath={{#if: {{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?FirstImage}}
portrait with the name centred underneath. The old layout sized the image at
|{{#ifeq: {{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?FirstImage#}}
100% of the sidebar column with padding-top:100%, so every person cost about
|File:Noimagefound.jpg
250px of height. Two thirds of library items have exactly one person, but the
|{{filepath:Teaching_Mudra_2_reduced_opacity.png|300}}
tail is long: "A Gathering of Brilliant Moons" has 26 (12 source authors, 13
|{{filepath:{{#titleparts:{{PAGENAME:{{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?FirstImage#}} }} }}|300}}
translators, editors, a publisher), which ran to roughly 5,000px of sidebar.
}}
At 48px per avatar the same list is about a fifth of the height and scans as
|{{filepath:Teaching_Mudra_2_reduced_opacity.png|300}}
a list rather than a stack of posters.
}}
 
|size=100%
48px, not smaller: these are portraits of masters that readers recognise by
|bgSize=cover
face, so the avatar has to stay legible as a face.
|depth=0
 
Roles are separated by a middot rather than <br>. The row is only two lines
tall, and stacking three roles vertically would undo the saving.
 
The image, phonetic name and Tibetan name arrive as parameters from
Module:SidebarPeople, which fetches them for every person in the sidebar in a
single query. This template previously looked each value up itself, costing
about eight #show calls per person.
 
It also fixes a bug that had blanked every portrait. FirstImage is a
Page-type property, so {{#show:...|?FirstImage}} renders it as a thumbnail
rather than returning a title. The old #if guard tested that rendered form,
got nothing usable, and fell through to the placeholder for everyone. The
module now asks for ?FirstImage# and passes the raw title.
-->
<div class="sidebar-person-avatar">{{#widget:SidebarPersonPageRoundImage
|filepath={{#if: {{{ img | }}}
|{{#ifeq: {{{ img | }}}
|File:Noimagefound.jpg
|{{filepath:Teaching_Mudra_2_reduced_opacity.png|300}}
|{{filepath:{{#titleparts:{{PAGENAME:{{{ img | }}}}} }}|150}}
}}
}}
</div>
|{{filepath:Teaching_Mudra_2_reduced_opacity.png|300}}
</div>
}}
<div class="col-8 col-md-12 pl-0 px-md-0 font-serif text-md-center d-flex align-items-center">
|size=100%
|bgSize=cover
|depth=0
}}
</div>
<div class="sidebar-person-text font-serif">
<div class="w-100">
<div class="w-100">
<div class="mt-md-2 text-150 line12">{{#if: {{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?MainNamePhon}}
<div class="sidebar-person-name line12">{{#if: {{{ phon | }}}
|{{#if:{{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?MainNameTib}}
|{{#if: {{{ tib | }}}
|{{I18n
|{{I18n
|en={{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?MainNamePhon}}
|en={{{ phon | }}}
|bo={{#invoke:String
|bo={{#invoke:String
|replace
|replace
|source={{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?MainNameTib}}
|source={{{ tib | }}}
|pattern=་$
|pattern=་$
|replace=།
|replace=།
Line 32: Line 57:
}}
}}
}}
}}
|{{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?MainNamePhon}}
|{{{ phon | }}}
}}<!--
Organisations have no MainNamePhon; they carry Orgname instead. Without this
fallback an institutional credit shows only its raw page title.
--> |{{#if: {{{ org | }}}
|{{{ org | }}}
|[[{{{ 1 | }}}]]
}}
}}
|[[{{{ 1 | }}}]]
}}</div>
}}</div>
<div class="opac-50 mt-1 text-130 font-italic line11">{{#arraymap:{{{ 2 | }}}
<div class="sidebar-person-roles opac-50 font-italic line11">{{#arraymap:{{{ 2 | }}}
|;
|;
|@@@
|@@@
|@@@
|@@@
|<br>
|&nbsp;·&nbsp;
}}</div>{{#ifexist:{{{ 1 | }}}||{{#ifexist:People/{{{ 1 | }}}|
}}</div>{{#ifexist:{{{ 1 | }}}||{{#ifexist:People/{{{ 1 | }}}|
<div class="carnelian mb-2">redirect needed</div>{{#set:PersonNameNeedsRedirect={{{ 1 | }}}}}|
<div class="carnelian mb-2">redirect needed</div>{{#set:PersonNameNeedsRedirect={{{ 1 | }}}}}|
<div class="carnelian mb-2">page missing</div>{{#set:PersonNameNeedsPage={{{ 1 | }}}}} }} }}
<div class="carnelian mb-2">page missing</div>{{#set:PersonNameNeedsPage={{{ 1 | }}}}} }} }}
</div>
</div>
</div>
</div>{{#widget:OverlayLink
</div>{{#widget:OverlayLink
|link=/index.php/{{#ifexist:{{{ 1 | }}}
|link=/index.php/{{#ifexist:{{{ 1 | }}}
|{{{ 1 | }}}
|{{{ 1 | }}}

Latest revision as of 13:46, 25 August 2026