Difference between revisions of "Template:MedalCount/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>Zyxw
(Move "text-align:center" to cells due to new default at MediaWiki:Common.css (revised 17:34, 23 June 2015). Example of prior formatting: http://web.archive.org/web/20150610/http://en.wikipedia.org/wiki/Ole_Einar_Bj%C3%B8rndalen)
imported>Zyxw
(Add an optional automatically calculated total row at bottom. Can replace the manually calculated total row often found in articles using this template.)
Line 1: Line 1:
<includeonly>
+
<noinclude>{| class="infobox" style="width:22em;"</noinclude>
 
|-
 
|-
 
| colspan="3" style="padding:0" |
 
| colspan="3" style="padding:0" |
 
{| style="margin:0; width:100%;"
 
{| style="margin:0; width:100%;"
 
{{#if:{{{type|}}}|
 
{{#if:{{{type|}}}|
! colspan="4" style="background:#cccccc; text-align:center;" {{!}} {{{type}}}
+
! colspan="4" style="background-color:#CCCCCC; text-align:center;" {{!}} {{{type}}}
 
}}
 
}}
 
|-
 
|-
! scope="col" style="background:#cccccc; text-align:center;" | {{#if:{{{event_label|}}}|{{{event_label}}}|Event}}
+
! scope="col" style="background-color:#CCCCCC; text-align:center;" | {{#if:{{{event_label|}}}|{{{event_label}}}|Event}}
! scope="col" style="background:gold;   text-align:center;" | 1{{small|st}}
+
! scope="col" style="background-color:#FFD700; text-align:center;" | 1{{small|st}}
! scope="col" style="background:silver; text-align:center;" | 2{{small|nd}}
+
! scope="col" style="background-color:#C0C0C0; text-align:center;" | 2{{small|nd}}
! scope="col" style="background:#CC9966; text-align:center;" | 3{{small|rd}}
+
! scope="col" style="background-color:#CC9966; text-align:center;" | 3{{small|rd}}
 
|-
 
|-
 
{{#if:{{{1|}}}|
 
{{#if:{{{1|}}}|
Line 81: Line 81:
 
{{!}} style="background-color:#FFCC99; text-align:center;" {{!}} {{#if:1|{{{40|}}}}}
 
{{!}} style="background-color:#FFCC99; text-align:center;" {{!}} {{#if:1|{{{40|}}}}}
 
}}
 
}}
|}</includeonly><noinclude>
+
{{#ifeq:{{yesno|{{{total|}}}}}|yes|
 +
! scope="row" style="text-align:left;" {{!}} {{#if:{{{total_label|}}}|{{{total_label|}}}|Total}}
 +
{{!}} style="background-color:#FEEC80; font-weight:bold; text-align:center;" {{!}} {{#expr:{{{2|0}}}+{{{6|0}}}+{{{10|0}}}+{{{14|0}}}+{{{18|0}}}+{{{22|0}}}+{{{26|0}}}+{{{30|0}}}+{{{34|0}}}+{{{38|0}}}}}
 +
{{!}} style="background-color:#E5E5E5; font-weight:bold; text-align:center;" {{!}} {{#expr:{{{3|0}}}+{{{7|0}}}+{{{11|0}}}+{{{15|0}}}+{{{19|0}}}+{{{23|0}}}+{{{27|0}}}+{{{31|0}}}+{{{35|0}}}+{{{39|0}}}}}
 +
{{!}} style="background-color:#FFCC99; font-weight:bold; text-align:center;" {{!}} {{#expr:{{{4|0}}}+{{{8|0}}}+{{{12|0}}}+{{{16|0}}}+{{{20|0}}}+{{{24|0}}}+{{{28|0}}}+{{{32|0}}}+{{{36|0}}}+{{{40|0}}}}}
 +
}}
 +
|}<noinclude>
 +
|}
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 04:15, 15 September 2015

Event 1st 2nd 3rd
Template documentation[view] [edit] [history] [purge]

Usage

Usage with table markup

Type
Event 1st 2nd 3rd
Event1 0 0 0
Event2 0 0 0
Event3 0 0 0
Event4 0 0 0
Event5 0 0 0
Event6 0 0 0
Event7 0 0 0
Event8 0 0 0
Event9 0 0 0
Event10 0 0 0
{| class="infobox" style="width:22em;"
  {{MedalCount |type=Type
  | Event1 | 0 | 0 | 0
  | Event2 | 0 | 0 | 0
  | Event3 | 0 | 0 | 0
  | Event4 | 0 | 0 | 0
  | Event5 | 0 | 0 | 0
  | Event6 | 0 | 0 | 0
  | Event7 | 0 | 0 | 0
  | Event8 | 0 | 0 | 0
  | Event9 | 0 | 0 | 0
  | Event10| 0 | 0 | 0
  }}
|}

Usage with MedalBox

Medal record
Sport
Representing Country
Podiums
Event 1st 2nd 3rd
Event1 0 0 0
Event2 0 0 0
Event3 0 0 0
Event4 0 0 0
Event5 0 0 0
Event6 0 0 0
Event7 0 0 0
Event8 0 0 0
Event9 0 0 0
Event10 0 0 0
{{MedalBox
| sport = Sport
| country = Country
| medals =
  {{MedalCount |type=Podiums
  | Event1 | 0 | 0 | 0
  | Event2 | 0 | 0 | 0
  | Event3 | 0 | 0 | 0
  | Event4 | 0 | 0 | 0
  | Event5 | 0 | 0 | 0
  | Event6 | 0 | 0 | 0
  | Event7 | 0 | 0 | 0
  | Event8 | 0 | 0 | 0
  | Event9 | 0 | 0 | 0
  | Event10| 0 | 0 | 0
  }}
}}

Usage with MedalTableTop

Name
Medal record
Sport
Representing Template:NRU
Podiums
Event 1st 2nd 3rd
Event1 0 0 0
Event2 0 0 0
Event3 0 0 0
Event4 0 0 0
Event5 0 0 0
Event6 0 0 0
Event7 0 0 0
Event8 0 0 0
Event9 0 0 0
Event10 0 0 0
{{MedalTableTop
| name = Name
| sport = Sport
| country_code = NRU
| medals =
  {{MedalCount |type=Podiums
  | Event1 | 0 | 0 | 0
  | Event2 | 0 | 0 | 0
  | Event3 | 0 | 0 | 0
  | Event4 | 0 | 0 | 0
  | Event5 | 0 | 0 | 0
  | Event6 | 0 | 0 | 0
  | Event7 | 0 | 0 | 0
  | Event8 | 0 | 0 | 0
  | Event9 | 0 | 0 | 0
  | Event10| 0 | 0 | 0
  }}
}}

Usage with Infobox sportsperson

Script error: No such module "If empty".
Sport
CountryCountry
SportSport
Collapse
Medal record
Event 1st 2nd 3rd
Event1 0 0 0
Event2 0 0 0
Event3 0 0 0
Event4 0 0 0
Event5 0 0 0
Event6 0 0 0
Event7 0 0 0
Event8 0 0 0
Event9 0 0 0
Event10 0 0 0
Template:Wikidata image
{{Infobox sportsperson
| name = Name
| country = Country
| sport = Sport
| medaltemplates =
  {{MedalCount
  | Event1 | 0 | 0 | 0
  | Event2 | 0 | 0 | 0
  | Event3 | 0 | 0 | 0
  | Event4 | 0 | 0 | 0
  | Event5 | 0 | 0 | 0
  | Event6 | 0 | 0 | 0
  | Event7 | 0 | 0 | 0
  | Event8 | 0 | 0 | 0
  | Event9 | 0 | 0 | 0
  | Event10| 0 | 0 | 0
  }}
}}

Example

Within an infobox

From Ole Einar Bjørndalen:

Script error: No such module "If empty".
Personal information
Born (1974-01-27) 27 January 1974 (age 51)
Drammen, Norway
Collapse
Medal record
Men's biathlon
Representing Template:NOR
Event 1st 2nd 3rd
Olympic Games 8 4 1
World Championships 19 12 9
Summer World Championships 1 1 1
Norwegian Championships 30 8 12
Summer Norwegian Championships 14 5 0
Junior World Championships 3 0 1
Junior Norwegian Championships 4 1 1
Total (135 medals) 79 31 25
Template:Wikidata image
{{Infobox biathlete
| name           = Ole Einar Bjørndalen
| birth_date     = {{birth date and age|df=yes|1974|1|27}}
| birth_place    = [[Drammen]], Norway
| show-medals    = yes
| medaltemplates =
  {{Medal|Sport|Men's [[biathlon]]}}
  {{Medal|Country|{{NOR}}}}
  {{MedalCount
  | [[Winter Olympic Games|Olympic Games]] | 8 | 4 | 1
  | [[Biathlon World Championships|World Championships]] | 19 | 12 | 9
  | {{nowrap|[[Summer Biathlon World Championships|Summer World Championships]]}} | 1 | 1 | 1
  | {{nowrap|[[Norwegian Biathlon Championships|Norwegian Championships]]}} | 30 | 8 | 12
  | {{nowrap|Summer Norwegian Championships}} | 14 | 5 | 0
  | {{nowrap|[[Biathlon Junior World Championships|Junior World Championships]]}} | 3 | 0 | 1
  | {{nowrap|Junior Norwegian Championships}} | 4 | 1 | 1
  | '''Total (135 medals)''' | '''79''' | '''31''' | '''25'''
  }}
}}

Automatically calculated total row

Medal record
Men's biathlon
Representing Template:NOR
Event 1st 2nd 3rd
Olympic Games 8 4 1
World Championships 19 12 9
Summer World Championships 1 1 1
Norwegian Championships 30 8 12
Summer Norwegian Championships 14 5 0
Junior World Championships 3 0 1
Junior Norwegian Championships 4 1 1
Total 79 31 25
{{MedalBox|medals=
  {{Medal|Sport|Men's [[biathlon]]}}
  {{Medal|Country|{{NOR}}}}
  {{MedalCount | total = yes
  | [[Winter Olympic Games|Olympic Games]] | 8 | 4 | 1
  | [[Biathlon World Championships|World Championships]] | 19 | 12 | 9
  | {{nowrap|[[Summer Biathlon World Championships|Summer World Championships]]}} | 1 | 1 | 1
  | {{nowrap|[[Norwegian Biathlon Championships|Norwegian Championships]]}} | 30 | 8 | 12
  | {{nowrap|Summer Norwegian Championships}} | 14 | 5 | 0
  | {{nowrap|[[Biathlon Junior World Championships|Junior World Championships]]}} | 3 | 0 | 1
  | {{nowrap|Junior Norwegian Championships}} | 4 | 1 | 1
  }}
}}

See also