Template:Gallery Section (Cargo): Difference between revisions

Template page
m (add logic to hide "see all" button if "count all" is given and)
m (test using count_all for lua)
Line 11: Line 11:
   |{{{title|}}}
   |{{{title|}}}
}}}}}}<!--
}}}}}}<!--
-->{{#if:{{{count all|}}}|{{#ifexpr:{{#expr:{{{count all|}}} - {{{limit|4}}}}}>0|{{#vardefine:show see all|y}}|{{#vardefine:show see all|n}} }}}}{{#vardefine:show see all|{{#switch:{{{see all|}}}
-->{{#if:{{{count_all|}}}|{{#ifexpr:{{#expr:{{{count_all|}}} - {{{limit|4}}}}}>0|{{#vardefine:show see all|y}}|{{#vardefine:show see all|n}} }}}}{{#vardefine:show see all|{{#switch:{{{see all|}}}
   |n=n
   |n=n
   |{{#var:show see all}}
   |{{#var:show see all}}
Line 17: Line 17:
-->{{#vardefine:CHARACTER|{{#replace:{{{character|}}}|'|}}}}<!--
-->{{#vardefine:CHARACTER|{{#replace:{{{character|}}}|'|}}}}<!--


-->{{#vardefine:see all|<a target="_blank" href="{{#invoke:ViewData URL|Files|character={{#var:CHARACTER}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}|order="{{{sort|}}}"|intro={{#var:header}}}}"><div class="bb character-grid center" style="margin-left:10px; display:inline-block; width:100px;"><div>see all{{#if:{{{count all|}}}|&nbsp;{{{count all}}}}}</div></div></a>}}<!--
-->{{#vardefine:see all|<a target="_blank" href="{{#invoke:ViewData URL|Files|character={{#var:CHARACTER}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}|order="{{{sort|}}}"|intro={{#var:header}}}}"><div class="bb character-grid center" style="margin-left:10px; display:inline-block; width:100px;"><div>see all{{#if:{{{count_all|}}}|&nbsp;{{{count_all}}}}}</div></div></a>}}<!--


-->{{#vardefine:see cameo|<a target="_blank" href="{{#invoke:ViewData URL|Files|cameo={{#var:CHARACTER}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}|order="{{{sort|}}}"|intro={{#var:header}}}}"><div class="bbdw character-grid center" style="margin-left:10px; display:inline-block; width:100px;"><div>see cameos</div></div></a>}}<!--
-->{{#vardefine:see cameo|<a target="_blank" href="{{#invoke:ViewData URL|Files|cameo={{#var:CHARACTER}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}|order="{{{sort|}}}"|intro={{#var:header}}}}"><div class="bbdw character-grid center" style="margin-left:10px; display:inline-block; width:100px;"><div>see cameos</div></div></a>}}<!--
Line 62: Line 62:
|see all=True by default (use 'n' to turn off)
|see all=True by default (use 'n' to turn off)
|see cameos=False by default (use 'y' to turn on)
|see cameos=False by default (use 'y' to turn on)
|count all=
|count_all=
}}
}}
</nowiki></pre>
</nowiki></pre>
Line 78: Line 78:
<code>|sort=</code> Optional. If set to <code>date</code>, the results will be sorted by descending date (with newer images after older ones). By default it sorts alphabetically.
<code>|sort=</code> Optional. If set to <code>date</code>, the results will be sorted by descending date (with newer images after older ones). By default it sorts alphabetically.


<code>|see all=</code> Optional. Controls the display of a "see all" button next to the header, that links to all results. It displays all the time by default. Use <code>|see all=n</code> to hide the button all the time. If <code>count all</code> is given, then this button won't display unless there is overflow.  
<code>|see all=</code> Optional. Controls the display of a "see all" button next to the header, that links to all results. It displays all the time by default. Use <code>|see all=n</code> to hide the button all the time. If <code>count_all</code> is given, then this button won't display unless there is overflow.  


<code>|see cameos=</code> Optional. Change to <code>y</code> to show a button to Special:ViewData that performs the same query, but with the character as a cameo instead. (e.g. Izayoi showing up in Hakumen's Arcade Mode)
<code>|see cameos=</code> Optional. Change to <code>y</code> to show a button to Special:ViewData that performs the same query, but with the character as a cameo instead. (e.g. Izayoi showing up in Hakumen's Arcade Mode)


<code>|count all=</code> Optional. Put a number here to display it next to the "see all" message (e.g. "see all 13"). If this number is entered, the template will check if the <code>see all</code> button needs to be shown and hide it if necessary.
<code>|count_all=</code> Optional. Put a number here to display it next to the "see all" message (e.g. "see all 13"). If this number is entered, the template will check if the <code>see all</code> button needs to be shown and hide it if necessary.


==See Also==
==See Also==

Revision as of 01:31, 11 September 2019

Creates a section of the Template:Master Gallery based on information stored through Template:Gallery Metadata.

Usage

{{Gallery Section (Cargo)
|character=
|location=
|weapon=
|source=
|section=
|artist=
|limit=
|widths=
|header=
|title=
|sort=
|see all=True by default (use 'n' to turn off)
|see cameos=False by default (use 'y' to turn on)
|count_all=
}}

Reference Template:Gallery Metadata for character, location, weapon, source, section, and artist.

|limits= Optional, the max number of images to show before truncating and displaying a "show more" link. Defaults to 4.

|widths= Optional, the width of each image in the gallery. Defaults to 250 (matching the default for Template:Gallery Section)

|header= Optional, sets the header depth. Accepts the values h2, h3, h4, h5. Leaving this out will default the title to regular text.

|title= Optional, defines the text to be used as the header for this gallery section. (e.g. Birthday Art)

|sort= Optional. If set to date, the results will be sorted by descending date (with newer images after older ones). By default it sorts alphabetically.

|see all= Optional. Controls the display of a "see all" button next to the header, that links to all results. It displays all the time by default. Use |see all=n to hide the button all the time. If count_all is given, then this button won't display unless there is overflow.

|see cameos= Optional. Change to y to show a button to Special:ViewData that performs the same query, but with the character as a cameo instead. (e.g. Izayoi showing up in Hakumen's Arcade Mode)

|count_all= Optional. Put a number here to display it next to the "see all" message (e.g. "see all 13"). If this number is entered, the template will check if the see all button needs to be shown and hide it if necessary.

See Also