Template:Gallery Section (Cargo): Difference between revisions

Template page
(wip, needs to be tested)
 
(update with custom URL to Special:ViewData, and add header, title, sort options)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
-->{{#vardefine:sort|{{#switch:{{{sort|}}}
  |date=Date DESC
  |_pageName
}}
}}<!--
-->{{#if:{{{title|}}}|
{{#vardefine:header|{{#switch:{{{header|h3}}}
  |h2=<h2 style="display:inline;">{{{title}}}</h2>
  |h3=<h3 style="display:inline;">{{{title}}}</h3>
  |h4=<h4 style="display:inline;">{{{title}}}</h4>
  |h5=<h5 style="display:inline;">{{{title}}}</h5>
  |{{{title|}}} }}
}}}}<!--
-->{{#vardefine:intro|<div>{{#var:header}}<a target="_blank" href="{{#invoke:ViewData URL|Files|character={{{character|}}}|location={{{location|}}}|weapon={{{weapon|}}}|artist={{{artist|}}}|section={{{section|}}}|source={{{source|}}}|intro={{#var:header}}}}"><div class="bb character-grid center" style="margin-left:10px; display:inline-block; width:65px;"><div>see all</div></div></a></div>
}}<!--
-->{{#cargo_query:
-->{{#cargo_query:
tables=Files
tables=Files
|fields=_pageName, caption
|fields=_pageName, Caption, Date
|where={{#if:{{{character|}}}|Files.Characters HOLDS '{{{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|}}}'}}
|where={{#if:{{{character|}}}|Files.Characters HOLDS '{{{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=date
|order by={{#var:sort}}
|limit={{{limit|10000}}}
|limit={{{limit|4}}}
|intro={{#var:intro}}
|default=
|default=
|more results text=more results
|more results text=
|format=gallery
|format=gallery
|show bytes=0
|show bytes=0
|show dimensions=0
|show dimensions=0
|show filename=0
|show filename=0
|caption field=caption
|caption field=Caption
|image width={{{widths|250}}}
|image width={{{widths|250}}}
}}
}}
Line 29: Line 45:
|limit=
|limit=
|widths=
|widths=
|header=
|title=
|sort=
}}
}}
</nowiki></pre>
</nowiki></pre>
Line 37: Line 56:


<code>|widths=</code> Optional, the width of each image in the gallery. Defaults to 250 (matching the default for [[Template:Gallery Section]])
<code>|widths=</code> Optional, the width of each image in the gallery. Defaults to 250 (matching the default for [[Template:Gallery Section]])
<code>|header=</code> Optional, sets the header depth. Accepts the values <code>h2</code>, <code>h3</code>, <code>h4</code>, <code>h5</code>. Leaving this out will default the title to regular text.
<code>|title=</code> Optional, defines the text to be used as the header for this gallery section. (e.g. Birthday Art)
<code>|sort=</code> Optional. If set to <code>date</code>, the results will be sorted by descending date (with newer images after older ones).


==See Also==
==See Also==
Line 43: Line 68:
* [[Template:Gallery Section (BBRadio)]]
* [[Template:Gallery Section (BBRadio)]]
* [[Template:Gallery Metadata]]
* [[Template:Gallery Metadata]]
* [[Module:ViewData URL]], builds a custom URL to Special:ViewData


[[Category:Graphic templates]]
[[Category:Graphic templates]]
</noinclude>
</noinclude>

Revision as of 01:00, 1 August 2019

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

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 10000 (matching the default for Template:Gallery Section).

|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).

See Also