Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Gallery Section (Cargo): Difference between revisions

Template page
m (fix bug where headers from previous calls to this template would carry over into later calls if the later one(s) didn't have a title specified)
(switch to load images inline and use tabs to separate cameos and main)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
-->{{#vardefine:sort|{{#switch:{{{sort|}}}
-->{{Gallery Section (Cargo)/1|sort={{{sort|}}}|header={{{header|}}}|title={{{title|}}}|see_all={{{see_all|}}}|character={{{character|}}}
  |date=Date DESC
|count_all={{{count_all|0}}}
  |_pageName
|count_cameos={{{count_cameos|0}}}
}}}}<!--
|limit={{{limit|4}}}
-->{{#vardefine:header|{{#switch:{{{header|}}}
}}<!--
  |h2=<h2 style="display:inline;">{{{title}}}</h2>
-->{{Gallery Section (Cargo)/2|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}|count_cameos={{{count_cameos|}}}
  |h3=<h3 style="display:inline;">{{{title}}}</h3>
}}<!--
  |h4=<h4 style="display:inline;">{{{title}}}</h4>
-->{{#if:{{{see_cameos|}}}|{{#ifexpr: {{#var:count_total}} > 0|
  |h5=<h5 style="display:inline;">{{{title}}}</h5>
{{#var:header}}
  |{{{title|}}}
{{#invoke:Tabs|main
}}}}<!--
|name={{{section|}}}{{{source|}}}
-->{{#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|}}}
|containerclass=forceland
  |n=n
|tab1=Main
  |{{#var:show see all}}
|tab2=Cameos
}}}}<!--
|content1={{Gallery Section (Cargo)/Q1|character={{{character|}}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}}}
-->{{#vardefine:CHARACTER|{{#replace:{{{character|}}}|'|}}}}<!--
{{Gallery Section (Cargo)/3|displayed={{{load_limit|4}}}|count_all={{{count_all|0}}}|load_limit=50|character={{#var:CHARACTER}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}|sort={{#var:sort}}|widths={{{widths|}}} }}
 
-->{{#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>}}<!--
 
Wrap the see cameo link in html for intro
-->{{#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:140px;"><div>see cameos{{#if:{{{count_cameos|}}}|&nbsp;({{{count_cameos}}})}}</div></div></a>}}<!--
 
Wrap the see cameo link in wikitext for default
-->{{#vardefine:see cameo default|[{{#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:140px;"><div>see cameos{{#if:{{{count_cameos|}}}|&nbsp;({{{count_cameos}}})}}</div></div>]}}<!--


-->{{#vardefine:intro|{{#if:{{#var:header}}|<div>{{#var:header}}{{#ifeq:{{#var:show see all}}|n||{{#var:see all}} }}{{#ifeq:{{{see_cameos|}}}|y|{{#var:see cameo}}}}</div>}}}}<!--
|content2={{Gallery Section (Cargo)/Q1|cameo={{{character|}}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}}}
{{Gallery Section (Cargo)/3|displayed={{{load_limit|4}}}|count_all={{{count_cameos|0}}}|load_limit=50|cameo={{#var:CHARACTER}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}|sort={{#var:sort}}|widths={{{widths|}}} }}


-->{{#vardefine:default|{{#if:{{#var: {{{section|}}} }}{{{count_cameos|}}}|{{#if:{{#var:header}}|<div>{{#var:header}}{{#var:see cameo default}}</div>}}}}}}<!--
}}
-->{{#cargo_query:
}}
tables=Files
|{{Gallery Section (Cargo)/Q2|character={{{character|}}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}}}
|fields=_pageName, Caption, Date
}}</includeonly><noinclude>
|where={{#if:{{{character|}}}|Files.Characters HOLDS '{{#var:CHARACTER}}'}} {{#if:{{{location|}}}|AND Files.Locations HOLDS '{{{location|}}}'}} {{#if:{{{weapon|}}}|AND Files.Weapons HOLDS '{{{weapons|}}}'}} {{#if:{{{artist|}}}|AND Files.Artists HOLDS '{{{artist|}}}'}} {{#if:{{{section|}}}|AND Files.Gallery_Sections HOLDS '{{{section|}}}'}} {{#if:{{{source|}}}|AND Files.Source HOLDS '{{{source|}}}'}}
|order by={{#var:sort}}
|limit={{{limit|4}}}
|intro={{#var:intro}}
|default={{#var:default}}
|more results text=
|format=gallery
|show bytes=0
|show dimensions=0
|show filename=0
|caption field=Caption
|image width={{{widths|250}}}
}}<!--
--></includeonly><noinclude>
{{Imbox Gallery Notice}}
{{Imbox Gallery Notice}}
Creates a section of the [[Template:Master Gallery]] based on information stored through [[Template:Gallery Metadata]].
Creates a section of the [[Template:Master Gallery]] based on information stored through [[Template:Gallery Metadata]].

Revision as of 02:01, 11 June 2020

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=
|count_cameos=
}}

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.

|count_cameos= Optional. Put the number of cameo images here.

See Also