Difference between revisions of "Template:Shops/TableHeader"

From MHWiki
m (Added "other" parameters for specific transclusion flexibility, changed "Margin" parameter to "TableMargin" to more consistently reflect parameter attribute, corrected default "NoteHeader" parameter)
m (Added captions)
 
Line 15: Line 15:
 
  | NoteHeader            = Defaults to ""              if left blank            , otherwise as per editor input
 
  | NoteHeader            = Defaults to ""              if left blank            , otherwise as per editor input
 
}}</nowiki>
 
}}</nowiki>
The '''<code><nowiki>NoteColumn</nowiki></code>''' parameter is the toggle used for adding the 5th column. Note that the input '''must''' be '''Yes''', not yes or anything else.<br>
+
The '''<code>NoteColumn</code>''' parameter is the toggle used for adding the 5th column. Note that the input '''must''' be '''Yes''', not yes or anything else.<br>
The '''<code><nowiki>NoteHeader</nowiki></code>''' parameter determines the header title of the 5th column, usually '''Power Type''' (for weapons) or '''Used With''' (for skins).
+
The '''<code>NoteHeader</code>''' parameter determines the header title of the 5th column, usually '''Power Type''' (for weapons) or '''Used With''' (for skins).
 +
----
 +
If a caption is desired:
 +
<nowiki>{{Shops/TableHeader
 +
| Caption              = Defaults to ""              if left blank            , otherwise as per editor input
 +
}}</nowiki>
 +
The '''<code>Caption</code>''' parameter determines the caption of the table, usually '''Bases''', '''Weapons''' or '''Skins''' (for the Trapsmith templates).
 
----
 
----
 
Optional parameters for this template include:
 
Optional parameters for this template include:
Line 26: Line 32:
 
  | TableOtherClass      = Defaults to ""              if left blank            , otherwise as per editor input
 
  | TableOtherClass      = Defaults to ""              if left blank            , otherwise as per editor input
 
  | TableOtherHTML        = Defaults to ""              if left blank            , otherwise as per editor input
 
  | TableOtherHTML        = Defaults to ""              if left blank            , otherwise as per editor input
 +
| CaptionAlignLeft      = Defaults to "center"        if left blank            , otherwise input "Yes" for "left"
 +
| CaptionMargin        = Defaults to ""              if left blank            , otherwise as per editor input
 +
| CaptionSize          = Defaults to ""              if left blank            , otherwise as per editor input
 
  | HeaderRowColour      = Defaults to "#dddddd"        if left blank            , otherwise as per editor input
 
  | HeaderRowColour      = Defaults to "#dddddd"        if left blank            , otherwise as per editor input
 
  | HeaderRowOtherStyle  = Defaults to ""              if left blank            , otherwise as per editor input
 
  | HeaderRowOtherStyle  = Defaults to ""              if left blank            , otherwise as per editor input
Line 70: Line 79:
 
For easy reference, the code transcluded by the template is:
 
For easy reference, the code transcluded by the template is:
 
  <nowiki><table style="margin: {{{TableMargin|1em}}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableWidth|75%}}}|4={{{TableWidth|60%}}}}}; max-width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableMaxWidth|75em}}}|4={{{TableMaxWidth|60em}}}}}; {{{TableOtherStyle|}}}" class="sortable b_and_p {{{TableOtherClass|}}}" {{{TableOtherHTML|}}}>
 
  <nowiki><table style="margin: {{{TableMargin|1em}}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableWidth|75%}}}|4={{{TableWidth|60%}}}}}; max-width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableMaxWidth|75em}}}|4={{{TableMaxWidth|60em}}}}}; {{{TableOtherStyle|}}}" class="sortable b_and_p {{{TableOtherClass|}}}" {{{TableOtherHTML|}}}>
 +
  <caption style="text-align: {{ifeq|{{{CaptionAlignLeft|}}}|Yes|left|center}}; margin: {{{CaptionMargin|}}}; font-size: {{{CaptionSize|}}}">{{{Caption|}}}</caption>
 
   <tr style="background-color: {{{HeaderRowColour|#dddddd}}}; {{{HeaderRowOtherStyle|}}}" class="sticky_table_row {{{HeaderRowOtherClass|}}}" {{{HeaderRowOtherHTML|}}}>
 
   <tr style="background-color: {{{HeaderRowColour|#dddddd}}}; {{{HeaderRowOtherStyle|}}}" class="sticky_table_row {{{HeaderRowOtherClass|}}}" {{{HeaderRowOtherHTML|}}}>
 
     <th style="text-align: {{ifeq|{{{ItemAlignCenter|}}}|Yes|center|left}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{ItemWidth|20%}}}|4={{{ItemWidth|25%}}}}}; {{{ItemOtherStyle|}}}" class="{{ifeq|{{{ItemSort|}}}|No|unsortable|}} {{{ItemOtherClass|}}}" {{{ItemOtherHTML|}}}>{{{ItemHeader|Item}}}</th>
 
     <th style="text-align: {{ifeq|{{{ItemAlignCenter|}}}|Yes|center|left}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{ItemWidth|20%}}}|4={{{ItemWidth|25%}}}}}; {{{ItemOtherStyle|}}}" class="{{ifeq|{{{ItemSort|}}}|No|unsortable|}} {{{ItemOtherClass|}}}" {{{ItemOtherHTML|}}}>{{{ItemHeader|Item}}}</th>
Line 77: Line 87:
 
     <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RefundWidth|20%}}}|4={{{RefundWidth|25%}}}}}; {{{RefundOtherStyle|}}}" class="{{ifeq|{{{RefundSort|}}}|Yes||unsortable}} {{{RefundOtherClass|}}}" {{{RefundOtherHTML|}}}>{{{RefundHeader|Refund}}}</th>
 
     <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RefundWidth|20%}}}|4={{{RefundWidth|25%}}}}}; {{{RefundOtherStyle|}}}" class="{{ifeq|{{{RefundSort|}}}|Yes||unsortable}} {{{RefundOtherClass|}}}" {{{RefundOtherHTML|}}}>{{{RefundHeader|Refund}}}</th>
 
   </tr></nowiki></noinclude><includeonly><table style="margin: {{{TableMargin|1em}}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableWidth|75%}}}|4={{{TableWidth|60%}}}}}; max-width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableMaxWidth|75em}}}|4={{{TableMaxWidth|60em}}}}}; {{{TableOtherStyle|}}}" class="sortable b_and_p {{{TableOtherClass|}}}" {{{TableOtherHTML|}}}>
 
   </tr></nowiki></noinclude><includeonly><table style="margin: {{{TableMargin|1em}}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableWidth|75%}}}|4={{{TableWidth|60%}}}}}; max-width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableMaxWidth|75em}}}|4={{{TableMaxWidth|60em}}}}}; {{{TableOtherStyle|}}}" class="sortable b_and_p {{{TableOtherClass|}}}" {{{TableOtherHTML|}}}>
 +
  <caption style="text-align: {{ifeq|{{{CaptionAlignLeft|}}}|Yes|left|center}}; margin: {{{CaptionMargin|}}}; font-size: {{{CaptionSize|}}}">{{{Caption|}}}</caption>
 
   <tr style="background-color: {{{HeaderRowColour|#dddddd}}}; {{{HeaderRowOtherStyle|}}}" class="sticky_table_row {{{HeaderRowOtherClass|}}}" {{{HeaderRowOtherHTML|}}}>
 
   <tr style="background-color: {{{HeaderRowColour|#dddddd}}}; {{{HeaderRowOtherStyle|}}}" class="sticky_table_row {{{HeaderRowOtherClass|}}}" {{{HeaderRowOtherHTML|}}}>
 
     <th style="text-align: {{ifeq|{{{ItemAlignCenter|}}}|Yes|center|left}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{ItemWidth|20%}}}|4={{{ItemWidth|25%}}}}}; {{{ItemOtherStyle|}}}" class="{{ifeq|{{{ItemSort|}}}|No|unsortable|}} {{{ItemOtherClass|}}}" {{{ItemOtherHTML|}}}>{{{ItemHeader|Item}}}</th>
 
     <th style="text-align: {{ifeq|{{{ItemAlignCenter|}}}|Yes|center|left}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{ItemWidth|20%}}}|4={{{ItemWidth|25%}}}}}; {{{ItemOtherStyle|}}}" class="{{ifeq|{{{ItemSort|}}}|No|unsortable|}} {{{ItemOtherClass|}}}" {{{ItemOtherHTML|}}}>{{{ItemHeader|Item}}}</th>

Latest revision as of 16:15, 25 May 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 ""               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).


If a caption is desired:

{{Shops/TableHeader
 | Caption               = Defaults to ""               if left blank            , otherwise as per editor input
}}

The Caption parameter determines the caption of the table, usually Bases, Weapons or Skins (for the Trapsmith templates).


Optional parameters for this template include:

{{Shops/TableHeader
 | TableMargin           = Defaults to "1em"            if left blank            , otherwise as per editor input
 | TableWidth            = Defaults to "60%" or 75%"    if left blank            , otherwise as per editor input
 | TableMaxWidth         = Defaults to "60em" or "75em" if left blank            , otherwise as per editor input
 | TableOtherStyle       = Defaults to ""               if left blank            , otherwise as per editor input
 | TableOtherClass       = Defaults to ""               if left blank            , otherwise as per editor input
 | TableOtherHTML        = Defaults to ""               if left blank            , otherwise as per editor input
 | CaptionAlignLeft      = Defaults to "center"         if left blank            , otherwise input "Yes" for "left"
 | CaptionMargin         = Defaults to ""               if left blank            , otherwise as per editor input
 | CaptionSize           = Defaults to ""               if left blank            , otherwise as per editor input
 | HeaderRowColour       = Defaults to "#dddddd"        if left blank            , otherwise as per editor input
 | HeaderRowOtherStyle   = Defaults to ""               if left blank            , otherwise as per editor input
 | HeaderRowOtherClass   = Defaults to ""               if left blank            , otherwise as per editor input
 | HeaderRowOtherHTML    = Defaults to ""               if left blank            , otherwise as per editor input
 | ItemAlignCenter       = Defaults to "left"           if left blank            , otherwise input "Yes" for "center"
 | ItemWidth             = Defaults to "25%" or "20%"   if left blank            , otherwise as per editor input
 | ItemOtherStyle        = Defaults to ""               if left blank            , otherwise as per editor input
 | ItemSort              = Defaults to ""               if left blank (sortable) , otherwise input "No" for "unsortable"
 | ItemOtherClass        = Defaults to ""               if left blank            , otherwise as per editor input
 | ItemOtherHTML         = Defaults to ""               if left blank            , otherwise as per editor input
 | ItemHeader            = Defaults to "Item"           if left blank            , otherwise as per editor input
 | NoteAlignLeft         = Defaults to "center"         if left blank            , otherwise input "Yes" for "left"
 | NoteWidth             = Defaults to "25%" or "20%"   if left blank            , otherwise as per editor input
 | NoteOtherStyle        = Defaults to ""               if left blank            , otherwise as per editor input
 | NoteSort              = Defaults to "unsortable"     if left blank            , otherwise input "Yes" for (sortable)
 | NoteOtherClass        = Defaults to ""               if left blank            , otherwise as per editor input
 | NoteOtherHTML         = Defaults to ""               if left blank            , otherwise as per editor input
 | CostAlignLeft         = Defaults to "center"         if left blank            , otherwise input "Yes" for "left"
 | CostWidth             = Defaults to "25%" or "20%"   if left blank            , otherwise as per editor input
 | CostOtherStyle        = Defaults to ""               if left blank            , otherwise as per editor input
 | CostSort              = Defaults to "unsortable"     if left blank            , otherwise input "Yes" for (sortable)
 | CostOtherClass        = Defaults to ""               if left blank            , otherwise as per editor input
 | CostOtherHTML         = Defaults to ""               if left blank            , otherwise as per editor input
 | CostHeader            = Defaults to "Cost"           if left blank            , otherwise as per editor input
 | RequirementAlignLeft  = Defaults to "center"         if left blank            , otherwise input "Yes" for "left"
 | RequirementWidth      = Defaults to "25%" or "20%"   if left blank            , otherwise as per editor input
 | RequirementOtherStyle = Defaults to ""               if left blank            , otherwise as per editor input
 | RequirementSort       = Defaults to "unsortable"     if left blank            , otherwise input "Yes" for (sortable)
 | RequirementOtherClass = Defaults to ""               if left blank            , otherwise as per editor input
 | RequirementOtherHTML  = Defaults to ""               if left blank            , otherwise as per editor input
 | RequirementHeader     = Defaults to "Requirement"    if left blank            , otherwise as per editor input
 | RefundAlignLeft       = Defaults to "center"         if left blank            , otherwise input "Yes" for "left"
 | RefundWidth           = Defaults to "25%" or "20%"   if left blank            , otherwise as per editor input
 | RefundOtherStyle      = Defaults to ""               if left blank            , otherwise as per editor input
 | RefundSort            = Defaults to "unsortable"     if left blank            , otherwise input "Yes" for (sortable)
 | RefundOtherClass      = Defaults to ""               if left blank            , otherwise as per editor input
 | RefundOtherHTML       = Defaults to ""               if left blank            , otherwise as per editor input
 | 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: {{{TableMargin|1em}}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableWidth|75%}}}|4={{{TableWidth|60%}}}}}; max-width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{TableMaxWidth|75em}}}|4={{{TableMaxWidth|60em}}}}}; {{{TableOtherStyle|}}}" class="sortable b_and_p {{{TableOtherClass|}}}" {{{TableOtherHTML|}}}>
  <caption style="text-align: {{ifeq|{{{CaptionAlignLeft|}}}|Yes|left|center}}; margin: {{{CaptionMargin|}}}; font-size: {{{CaptionSize|}}}">{{{Caption|}}}</caption>
  <tr style="background-color: {{{HeaderRowColour|#dddddd}}}; {{{HeaderRowOtherStyle|}}}" class="sticky_table_row {{{HeaderRowOtherClass|}}}" {{{HeaderRowOtherHTML|}}}>
    <th style="text-align: {{ifeq|{{{ItemAlignCenter|}}}|Yes|center|left}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{ItemWidth|20%}}}|4={{{ItemWidth|25%}}}}}; {{{ItemOtherStyle|}}}" class="{{ifeq|{{{ItemSort|}}}|No|unsortable|}} {{{ItemOtherClass|}}}" {{{ItemOtherHTML|}}}>{{{ItemHeader|Item}}}</th>
    {{ifeq|1={{{NoteColumn|}}}|2=Yes|3=<th style="text-align: {{ifeq|{{{NoteAlignLeft|}}}|Yes|left|center}}; width: {{{NoteWidth|20%}}}; {{{NoteOtherStyle|}}}" class="{{ifeq|{{{NoteSort|}}}|Yes||unsortable}} {{{NoteOtherClass|}}}" {{{NoteOtherHTML|}}}>{{{NoteHeader|}}}</th>|4=}}
    <th style="text-align: {{ifeq|{{{CostAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{CostWidth|20%}}}|4={{{CostWidth|25%}}}}}; {{{CostOtherStyle|}}}" class="{{ifeq|{{{CostSort|}}}|Yes||unsortable}} {{{CostOtherClass|}}}" {{{CostOtherHTML|}}}>{{{CostHeader|Cost}}}</th>
    <th style="text-align: {{ifeq|{{{RequirementAlignLeft|}}}|Yes|left|center}}: width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RequirementWidth|20%}}}|4={{{RequirementWidth|25%}}}}}; {{{RequirementOtherStyle|}}}" class="{{ifeq|{{{RequirementSort|}}}|Yes||unsortable}} {{{RequirementOtherClass|}}}" {{{RequirementOtherHTML|}}}>{{{RequirementHeader|Requirement}}}</th>
    <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RefundWidth|20%}}}|4={{{RefundWidth|25%}}}}}; {{{RefundOtherStyle|}}}" class="{{ifeq|{{{RefundSort|}}}|Yes||unsortable}} {{{RefundOtherClass|}}}" {{{RefundOtherHTML|}}}>{{{RefundHeader|Refund}}}</th>
  </tr>