Difference between revisions of "Template:Shops/TableHeader"

From MHWiki
m (Added more documentation)
m (Added full table mockup)
Line 1: Line 1:
 
<noinclude>In order to use this template, insert '''<code><nowiki>{{Shops/TableHeader}}</nowiki></code>'''.<br>
 
<noinclude>In order to use this template, insert '''<code><nowiki>{{Shops/TableHeader}}</nowiki></code>'''.<br>
Please note that sole usage of this '''<code><nowiki>{{Shops/TableHeader}}</nowiki></code>''' template is '''not''' sufficient.<br>
+
Please note that sole usage of this '''<code><nowiki>{{Shops/TableHeader}}</nowiki></code>''' template is '''not''' sufficient for generating a full table.<br>
It '''must''' be paired alongside various '''<code><nowiki>{{Shops/TableRow/XXX}}</nowiki></code>''' templates, where '''XXX''' represents a shop item.<br>
+
It '''must''' be placed '''above''' various '''<code><nowiki>{{Shops/TableRow/XXX}}</nowiki></code>''' templates, where '''XXX''' represents a shop item.<br>
It '''must''' be closed with a '''<code><nowiki></table></nowiki></code>''' tag ('''NOT <code><nowiki>|}</nowiki></code>'''!).
+
It '''must''' be placed '''above''' a '''<code><nowiki></table></nowiki></code>''' tag ('''NOT <code><nowiki>|}</nowiki></code>'''!), which is placed '''below''' the  various '''<code><nowiki>{{Shops/TableRow/XXX}}</nowiki></code>''' templates.
 +
 
 +
A mockup of a full table is shown below:<br>
 +
'''<code><nowiki>{{Shops/TableHeader}}</nowiki></code>'''<br>
 +
'''<code><nowiki>{{Shops/TableRow/ABC}}</nowiki></code>'''<br>
 +
'''<code><nowiki>{{Shops/TableRow/XYZ}}</nowiki></code>'''<br>
 +
'''<code><nowiki></table></nowiki></code>'''
 
----
 
----
 
There are '''no''' mandatory parameters for this template, however, these parameters '''will''' get used when wanting a 5-column table (the default is a 4-column table):
 
There are '''no''' mandatory parameters for this template, however, these parameters '''will''' get used when wanting a 5-column table (the default is a 4-column table):

Revision as of 22:43, 23 February 2022

In order to use this template, insert {{Shops/TableHeader}}.
Please note that sole usage of this {{Shops/TableHeader}} template is not sufficient for generating a full table.
It must be placed above various {{Shops/TableRow/XXX}} templates, where XXX represents a shop item.
It must be placed above a </table> tag (NOT |}!), which is placed below the various {{Shops/TableRow/XXX}} templates.

A mockup of a full table is shown below:
{{Shops/TableHeader}}
{{Shops/TableRow/ABC}}
{{Shops/TableRow/XYZ}}
</table>


There are no mandatory parameters for this template, however, these parameters will get used when wanting a 5-column table (the default is a 4-column table):

{{Shops/TableHeader
 | NoteColumn             = Defaults to ""            if left blank (no column)    , otherwise input "Yes" for the Note column to appear
 | NoteHeader             = Defaults to "Note"        if left blank                , otherwise as per editor input
}}

The NoteColumn parameter is the toggle used for adding the 5th column. Note that the input must be Yes, not yes or anything else.
The NoteHeader parameter determines the header title of the 5th column, usually Power Type (for weapons) or Used With (for skins).


Optional parameters for this template include:

{{Shops/TableHeader
 | Margin                 = Defaults to "1em"         if left blank (1em allaround), otherwise as per editor input
 | HeaderRowColour        = Defaults to "#dddddd"     if left blank                , otherwise as per editor input
 | ItemAlignCenter        = Defaults to "left"        if left blank                , otherwise input "Yes" for "center"
 | ItemSort               = Defaults to ""            if left blank (sortable)     , otherwise input "No" for "unsortable"
 | ItemHeader             = Defaults to "Item"        if left blank                , otherwise as per editor input
 | NoteColumn             = Defaults to ""            if left blank (no column)    , otherwise input "Yes" for the Note column to appear
 | NoteAlignLeft          = Defaults to "center"      if left blank                , otherwise input "Yes" for "left"
 | NoteSort               = Defaults to ""            if left blank (sortable)     , otherwise input "No" for "unsortable"
 | NoteHeader             = Defaults to "Note"        if left blank                , otherwise as per editor input
 | CostAlignLeft          = Defaults to "center"      if left blank                , otherwise input "Yes" for "left"
 | CostSort               = Defaults to ""            if left blank (sortable)     , otherwise input "No" for "unsortable"
 | CostHeader             = Defaults to "Cost"        if left blank                , otherwise as per editor input
 | RequirementAlignLeft   = Defaults to "center"      if left blank                , otherwise input "Yes" for "left"
 | RequirementSort        = Defaults to ""            if left blank (sortable)     , otherwise input "No" for "unsortable"
 | RequirementHeader      = Defaults to "Requirement" if left blank                , otherwise as per editor input
 | RefundAlignLeft        = Defaults to "center"      if left blank                , otherwise input "Yes" for "left"
 | RefundSort             = Defaults to ""            if left blank (sortable)     , otherwise input "No" for "unsortable"
 | RefundHeader           = Defaults to "Refund"      if left blank                , otherwise as per editor input
}}

Should any of them be used very often, it may suggest that a revision to the base template is needed. Please submit a proposal to the other editors and decide if this change should be made.
DO NOT edit the base template unilaterally as this may cause the transclusion to break down.


For easy reference, the code transcluded by the template is:

<table style="margin: {{{Margin|1em}}}" class="sortable b_and_p">
  <tr style="background-color: {{{HeaderRowColour|#dddddd}}}" class="sticky_table_row">
    <th style="text-align: {{ifeq|{{{ItemAlignCenter|}}}|Yes|center|left}}" class="{{ifeq|{{{ItemSort|}}}|No|unsortable|}}">{{{ItemHeader|Item}}}</th>
    {{ifeq|1={{{NoteColumn|}}}|2=Yes|3=<th style="text-align: {{ifeq|{{{NoteAlignLeft|}}}|Yes|left|center}}" class="{{ifeq|{{{NoteSort|}}}|No|unsortable|}}">{{{NoteHeader|Note}}}</th>|4=}}
    <th style="text-align: {{ifeq|{{{CostAlignLeft|}}}|Yes|left|center}}" class="{{ifeq|{{{CostSort|}}}|No|unsortable|}}">{{{CostHeader|Cost}}}</th>
    <th style="text-align: {{ifeq|{{{RequirementAlignLeft|}}}|Yes|left|center}}" class="{{ifeq|{{{RequirementSort|}}}|No|unsortable|}}">{{{RequirementHeader|Requirement}}}</th>
    <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}" class="{{ifeq|{{{RefundSort|}}}|No|unsortable|}}">{{{RefundHeader|Refund}}}</th>
  </tr>