Template:SidebarPersonBadge: Difference between revisions

From Bodhicitta
(VSCode edit)
(VSCode edit)
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="col-sm-6 col-md-12 position-relative p-3 rounded-xl" style="width: 100%;"><!--
Portrait, name and roles for one person in a library-item sidebar.
 
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="row">
<div class="row">
<div class="col-4 col-md-12">
<div class="col-4 col-md-12">
<div class="mx-auto" style="max-width: 200px;">{{#widget:SidebarPersonPageRoundImage
<div class="mx-auto" style="max-width: 200px;">{{#widget:SidebarPersonPageRoundImage
|filepath={{#if: {{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?FirstImage}}
|filepath={{#if: {{{ img | }}}
|{{#ifeq: {{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?FirstImage#}}
|{{#ifeq: {{{ img | }}}
|File:Noimagefound.jpg
|File:Noimagefound.jpg
|{{filepath:Teaching_Mudra_2_reduced_opacity.png|300}}
|{{filepath:Teaching_Mudra_2_reduced_opacity.png|300}}
|{{filepath:{{#titleparts:{{PAGENAME:{{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?FirstImage#}} }} }}|300}}
|{{filepath:{{#titleparts:{{PAGENAME:{{{ img | }}}}} }}|300}}
}}
}}
|{{filepath:Teaching_Mudra_2_reduced_opacity.png|300}}
|{{filepath:Teaching_Mudra_2_reduced_opacity.png|300}}
Line 19: Line 32:
<div class="col-8 col-md-12 pl-0 px-md-0 font-serif text-md-center d-flex align-items-center">
<div class="col-8 col-md-12 pl-0 px-md-0 font-serif text-md-center d-flex align-items-center">
<div class="w-100">
<div class="w-100">
<div class="mt-md-2 text-150 line12">{{#if: {{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?MainNamePhon}}
<div class="mt-md-2 text-150 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 45:
}}
}}
}}
}}
|{{#show:People/{{PAGENAME:{{{ 1 | }}}}}|?MainNamePhon}}
|{{{ phon | }}}
}}
}}
|[[{{{ 1 | }}}]]
|[[{{{ 1 | }}}]]

Revision as of 17:02, 21 August 2026