Difference between revisions of "Template:Shops/TableHeader"

From MHWiki
m (Added full table mockup)
m (Removed unnecessary space, added width parameters, changed default sort parameters)
Line 12: Line 12:
 
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):
 
  <nowiki>{{Shops/TableHeader
 
  <nowiki>{{Shops/TableHeader
  | NoteColumn             = Defaults to ""           if left blank (no column)   , otherwise input "Yes" for the Note column to appear
+
  | 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
+
  | NoteHeader           = Defaults to "Note"           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><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>
Line 20: Line 20:
 
Optional parameters for this template include:
 
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            , otherwise as per editor input
  | HeaderRowColour       = Defaults to "#dddddd"     if left blank               , otherwise as per editor input
+
| TableWidth          = Defaults to "60%" or 75%"    if left blank            , otherwise as per editor input
  | ItemAlignCenter       = Defaults to "left"       if left blank               , otherwise input "Yes" for "center"
+
| TableMaxWidth        = Defaults to "60em" or "75em" if left blank           , otherwise as per editor input
  | ItemSort               = Defaults to ""           if left blank (sortable)     , otherwise input "No" for "unsortable"
+
  | HeaderRowColour     = Defaults to "#dddddd"       if left blank           , otherwise as per editor input
  | ItemHeader             = Defaults to "Item"       if left blank               , otherwise as per editor input
+
  | ItemAlignCenter     = Defaults to "left"           if left blank           , otherwise input "Yes" for "center"
  | NoteColumn             = Defaults to ""           if left blank (no column)   , otherwise input "Yes" for the Note column to appear
+
  | ItemSort             = Defaults to ""               if left blank (sortable) , otherwise input "No" for "unsortable"
  | NoteAlignLeft         = Defaults to "center"     if left blank               , otherwise input "Yes" for "left"
+
| ItemWidth            = Defaults to "25%" or "20%"  if left blank            , otherwise as per editor input
  | NoteSort               = Defaults to ""           if left blank (sortable)    , otherwise input "No" for "unsortable"
+
  | ItemHeader           = Defaults to "Item"           if left blank           , otherwise as per editor input
  | NoteHeader            = Defaults to "Note"       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
  | CostAlignLeft         = Defaults to "center"     if left blank               , otherwise input "Yes" for "left"
+
  | NoteAlignLeft       = Defaults to "center"         if left blank           , otherwise input "Yes" for "left"
  | CostSort               = Defaults to ""           if left blank (sortable)    , otherwise input "No" for "unsortable"
+
  | NoteSort             = Defaults to "unsortable"     if left blank           , otherwise input "Yes" for (sortable)
  | CostHeader             = Defaults to "Cost"       if left blank               , otherwise as per editor input
+
| NoteHeader          = Defaults to "Note"           if left blank            , otherwise as per editor input
  | RequirementAlignLeft   = 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
  | RequirementSort       = Defaults to ""           if left blank (sortable)    , otherwise input "No" for "unsortable"
+
  | CostAlignLeft       = Defaults to "center"         if left blank           , otherwise input "Yes" for "left"
  | RequirementHeader     = Defaults to "Requirement" if left blank               , otherwise as per editor input
+
  | CostSort             = Defaults to "unsortable"     if left blank           , otherwise input "Yes" for (sortable)
  | RefundAlignLeft       = 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
  | RefundSort             = Defaults to ""           if left blank (sortable)    , otherwise input "No" for "unsortable"
+
  | CostHeader           = Defaults to "Cost"           if left blank           , otherwise as per editor input
  | RefundHeader           = Defaults to "Refund"     if left blank               , otherwise as per editor input
+
  | RequirementAlignLeft = Defaults to "center"         if left blank           , otherwise input "Yes" for "left"
 +
  | RequirementSort     = Defaults to "unsortable"     if left blank           , otherwise input "Yes" for (sortable)
 +
| RequirementWidth     = Defaults to "25%" or "20%"   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"
 +
  | RefundSort           = Defaults to "unsortable"     if left blank           , otherwise input "Yes" for (sortable)
 +
| RefundWidth          = Defaults to "25%" or "20%"   if left blank            , otherwise as per editor input
 +
  | RefundHeader         = Defaults to "Refund"         if left blank           , otherwise as per editor input
 
}}</nowiki>
 
}}</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>
 
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>
Line 43: Line 50:
 
----
 
----
 
For easy reference, the code transcluded by the template is:
 
For easy reference, the code transcluded by the template is:
  <nowiki><table style="margin: {{{Margin|1em}}}" class="sortable b_and_p">
+
  <nowiki><table style="margin: {{{Margin|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}}}}}" 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}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{ItemWidth|20%}}}|4={{{ItemWidth|25%}}}}}" 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=}}
+
     {{ifeq|1={{{NoteColumn|}}}|2=Yes|3=<th style="text-align: {{ifeq|{{{NoteAlignLeft|}}}|Yes|left|center}}; width: {{{NoteWidth|20%}}}" class="{{ifeq|{{{NoteSort|}}}|Yes||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|{{{CostAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{CostWidth|20%}}}|4={{{CostWidth|25%}}}}}" class="{{ifeq|{{{CostSort|}}}|Yes||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|{{{RequirementAlignLeft|}}}|Yes|left|center}}: width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RequirementWidth|20%}}}|4={{{RequirementWidth|25%}}}}}" class="{{ifeq|{{{RequirementSort|}}}|Yes||unsortable}}">{{{RequirementHeader|Requirement}}}</th>
     <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}" class="{{ifeq|{{{RefundSort|}}}|No|unsortable|}}">{{{RefundHeader|Refund}}}</th>
+
     <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RefundWidth|20%}}}|4={{{RefundWidth|25%}}}}}" class="{{ifeq|{{{RefundSort|}}}|Yes||unsortable}}">{{{RefundHeader|Refund}}}</th>
   </tr></nowiki></noinclude><includeonly><table style="margin: {{{Margin|1em}}}" class="sortable b_and_p">
+
   </tr></nowiki></noinclude><includeonly><table style="margin: {{{Margin|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}}}}}" 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}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{ItemWidth|20%}}}|4={{{ItemWidth|25%}}}}}" 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=}}
+
     {{ifeq|1={{{NoteColumn|}}}|2=Yes|3=<th style="text-align: {{ifeq|{{{NoteAlignLeft|}}}|Yes|left|center}}; width: {{{NoteWidth|20%}}}" class="{{ifeq|{{{NoteSort|}}}|Yes||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|{{{CostAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{CostWidth|20%}}}|4={{{CostWidth|25%}}}}}" class="{{ifeq|{{{CostSort|}}}|Yes||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|{{{RequirementAlignLeft|}}}|Yes|left|center}}: width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RequirementWidth|20%}}}|4={{{RequirementWidth|25%}}}}}" class="{{ifeq|{{{RequirementSort|}}}|Yes||unsortable}}">{{{RequirementHeader|Requirement}}}</th>
     <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}" class="{{ifeq|{{{RefundSort|}}}|No|unsortable|}}">{{{RefundHeader|Refund}}}</th>
+
     <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RefundWidth|20%}}}|4={{{RefundWidth|25%}}}}}" class="{{ifeq|{{{RefundSort|}}}|Yes||unsortable}}">{{{RefundHeader|Refund}}}</th>
 
   </tr></includeonly>
 
   </tr></includeonly>

Revision as of 21:40, 22 March 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            , 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
 | 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"
 | ItemWidth            = Defaults to "25%" or "20%"   if left blank            , otherwise as per editor input
 | 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 "unsortable"     if left blank            , otherwise input "Yes" for (sortable)
 | NoteHeader           = Defaults to "Note"           if left blank            , otherwise as per editor input
 | NoteWidth            = Defaults to "25%" or "20%"   if left blank            , otherwise as per editor input
 | CostAlignLeft        = Defaults to "center"         if left blank            , otherwise input "Yes" for "left"
 | CostSort             = Defaults to "unsortable"     if left blank            , otherwise input "Yes" for (sortable)
 | CostWidth            = Defaults to "25%" or "20%"   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"
 | RequirementSort      = Defaults to "unsortable"     if left blank            , otherwise input "Yes" for (sortable)
 | RequirementWidth     = Defaults to "25%" or "20%"   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"
 | RefundSort           = Defaults to "unsortable"     if left blank            , otherwise input "Yes" for (sortable)
 | RefundWidth          = Defaults to "25%" or "20%"   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: {{{Margin|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}}}}}" class="sortable b_and_p">
  <tr style="background-color: {{{HeaderRowColour|#dddddd}}}" class="sticky_table_row">
    <th style="text-align: {{ifeq|{{{ItemAlignCenter|}}}|Yes|center|left}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{ItemWidth|20%}}}|4={{{ItemWidth|25%}}}}}" class="{{ifeq|{{{ItemSort|}}}|No|unsortable|}}">{{{ItemHeader|Item}}}</th>
    {{ifeq|1={{{NoteColumn|}}}|2=Yes|3=<th style="text-align: {{ifeq|{{{NoteAlignLeft|}}}|Yes|left|center}}; width: {{{NoteWidth|20%}}}" class="{{ifeq|{{{NoteSort|}}}|Yes||unsortable}}">{{{NoteHeader|Note}}}</th>|4=}}
    <th style="text-align: {{ifeq|{{{CostAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{CostWidth|20%}}}|4={{{CostWidth|25%}}}}}" class="{{ifeq|{{{CostSort|}}}|Yes||unsortable}}">{{{CostHeader|Cost}}}</th>
    <th style="text-align: {{ifeq|{{{RequirementAlignLeft|}}}|Yes|left|center}}: width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RequirementWidth|20%}}}|4={{{RequirementWidth|25%}}}}}" class="{{ifeq|{{{RequirementSort|}}}|Yes||unsortable}}">{{{RequirementHeader|Requirement}}}</th>
    <th style="text-align: {{ifeq|{{{RefundAlignLeft|}}}|Yes|left|center}}; width: {{ifeq|1={{{NoteColumn|}}}|2=Yes|3={{{RefundWidth|20%}}}|4={{{RefundWidth|25%}}}}}" class="{{ifeq|{{{RefundSort|}}}|Yes||unsortable}}">{{{RefundHeader|Refund}}}</th>
  </tr>