Difference between revisions of "Template:GroupTableColHeader"

From QWiki
m (Tweaking to enable "Points" column)
m (Rolling back because this broke existing table headers)
 
Line 1: Line 1:
 
<includeonly>|- style="background-color:#f2f2f2;"
 
<includeonly>|- style="background-color:#f2f2f2;"
!style="width:16px;"| <small>#</small>
+
!style="width:16px;"|<small>#</small> <!-- show place number in header cell -->
!colspan="{{{col|}}}" style="text-align:left;"| <small>{{{1}}}</small>
+
!colspan="{{#expr:3-{{#if:{{{win_m|}}}{{{lose_m|}}}|1|0}}-{{#if:{{{win_g|}}}{{{lose_g|}}}|1|0}}-{{#if:{{{diff|}}}|1|0}}}}" style="text-align:left;" class="grouptableslot"| <small>{{{1|}}}</small> <!-- show the player name with the correct colspan -->
{{#if:{{{games}}}|{{!}}style="width:35px;text-align:center;"{{!}}'''<small>Games</small>'''|}}
+
!<!--class="grouptable-games" -->style="width: 35px; white-space: pre; text-align:center;"|'''{{{win_m|<small>Games</small>}}}''' <!-- always show match scores --><!--
{{#if:{{{maps}}}|{{!}}style="width:35px;text-align:center;"{{!}}'''<small>Maps</small>'''|}}
+
-->{{!}}{{!}}<!--class="grouptable-games" -->style="width: 35px; white-space: pre; text-align:center;"{{!}}{{{win_g|<small>Maps</small>}}}<!--
{{#if:{{{diff}}}|{{!}}style="width:35px;text-align:center;"{{!}}'''<small>{{abbr|Diff|Map difference}}</small>'''|}}
+
-->{{#if: {{{diff|}}} <!-- if diff= is present, show it as well
{{#if:{{{points}}}|{{!}}style="width:35px;text-align:center;"{{!}}'''<small>Points'''</small>|}}</includeonly><noinclude>{{documentation}}[[Category:Templates]]</noinclude>
+
-->| {{!}}{{!}}<!--class="grouptable-games" -->style="width: 35px; white-space: pre; text-align: center;"{{!}}<small>{{abbr|Diff|Map difference}}</small>
 +
}}{{#ifeq:{{lc:{{#var:show_points|}}}}|true<!-- if show_p present, show points 
 +
-->| {{!}}{{!}}<!--class="grouptable-points"-->style="width: 32px; white-space: pre; text-align:center;"{{!}}<!--
 +
-->{{#if: {{{win_m|0}}}{{{lose_m|0}}}<!-- if win_m or lose_m is present, calculate points
 +
  -->|  {{#if: {{{tie_m|}}}<!-- if tie_m is present, include tie matches in calculation 
 +
  -->| '''<i>{{#expr: ({{{win_m}}}*{{#var:win_points|3}}) + ({{#if:{{{tie_m|}}}|{{{tie_m}}}|0}}*{{#var:tie_points|1}}) + {{#if:{{{temp_p|}}}|{{{temp_p}}}|0}}}}p</i><!--
 +
  -->}}<!--
 +
  -->| '''<i>0p</i>'''<!--
 +
  -->}}<!--
 +
-->}}
 +
</includeonly><noinclude>{{documentation}}[[Category:Templates]]</noinclude>

Latest revision as of 08:38, 15 February 2021

Documentation (view - edit)

Adds a column header row to a group table. This template is used inbetween the templates {{GroupTableStart}} and {{GroupTableSlot}}, which have to end with with {{GroupTableEnd}}).

Example #1

{{GroupTableStart|GroupTableStart|width=100%}}
{{GroupTableColHeader|Nation|games=1|maps=1|diff=1}}
{{GroupTableEnd}}

Gives us:

GroupTableStart
# Nation Games Maps Diff

Example #1

{{GroupTableStart|GroupTableStart|width=100%}}
{{GroupTableColHeader|Nation|games=1|maps=1|diff=}}
{{GroupTableEnd}}

Gives us:

GroupTableStart
# Nation Games Maps

Parameters

The following parameters can be used for this template

first unnamed argument
The first unnamed argument of the parameter list is used as the name of player column. Examples could be Player, Team or Nation.
|games=
(Optional) If not empty, it will display "Games" header
|maps=
(Optional) If not empty, it will display "Maps" header
|diff=
(Optional) If not empty, it will display "Diff" header