Difference between revisions of "Template:Shops/TableHeader"

From MHWiki
m (Typo 2)
m (Added more documentation)
Line 1: Line 1:
<noinclude><span style="float: left; margin-right: 0.416em">To use:</span><pre style= "display: contents">{{Shops/TableHeader}}</pre>Optional parameters:
+
<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>
 +
It '''must''' be paired alongside 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>'''!).
 +
----
 +
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):
 +
<nowiki>{{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
 +
}}</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><nowiki>NoteHeader</nowiki></code>''' 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:
 
  <nowiki>{{Shops/TableHeader
 
  <nowiki>{{Shops/TableHeader
 
  | Margin                = Defaults to "1em"        if left blank (1em allaround), otherwise as per editor input
 
  | Margin                = Defaults to "1em"        if left blank (1em allaround), otherwise as per editor input
Line 9: Line 22:
 
  | NoteAlignLeft          = Defaults to "center"      if left blank                , otherwise input "Yes" for "left"
 
  | NoteAlignLeft          = Defaults to "center"      if left blank                , otherwise input "Yes" for "left"
 
  | NoteSort              = Defaults to ""            if left blank (sortable)    , otherwise input "No" for "unsortable"
 
  | NoteSort              = Defaults to ""            if left blank (sortable)    , otherwise input "No" for "unsortable"
  | NoteHeader            = Defaults to "Cost"        if left blank                , otherwise as per editor input
+
  | NoteHeader            = Defaults to "Note"        if left blank                , otherwise as per editor input
 
  | CostAlignLeft          = Defaults to "center"      if left blank                , otherwise input "Yes" for "left"
 
  | CostAlignLeft          = Defaults to "center"      if left blank                , otherwise input "Yes" for "left"
 
  | CostSort              = Defaults to ""            if left blank (sortable)    , otherwise input "No" for "unsortable"
 
  | CostSort              = Defaults to ""            if left blank (sortable)    , otherwise input "No" for "unsortable"
Line 19: Line 32:
 
  | RefundSort            = Defaults to ""            if left blank (sortable)    , otherwise input "No" for "unsortable"
 
  | RefundSort            = Defaults to ""            if left blank (sortable)    , otherwise input "No" for "unsortable"
 
  | RefundHeader          = Defaults to "Refund"      if left blank                , otherwise as per editor input
 
  | RefundHeader          = Defaults to "Refund"      if left blank                , otherwise as per editor input
}}</nowiki></noinclude><includeonly><table style="margin: {{{Margin|1em}}}" class="sortable b_and_p">
+
}}</nowiki>
 +
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.<br>
 +
'''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:
 +
<nowiki><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></nowiki></noinclude><includeonly><table style="margin: {{{Margin|1em}}}" class="sortable b_and_p">
 
   <tr style="background-color: {{{HeaderRowColour|#dddddd}}}" class="sticky_table_row">
 
   <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>
 
     <th style="text-align: {{ifeq|{{{ItemAlignCenter|}}}|Yes|center|left}}" class="{{ifeq|{{{ItemSort|}}}|No|unsortable|}}">{{{ItemHeader|Item}}}</th>

Revision as of 21:02, 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.
It must be paired alongside various {{Shops/TableRow/XXX}} templates, where XXX represents a shop item.
It must be closed with a </table> tag (NOT |}!).


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>