Difference between revisions of "User:Natemckn/sandbox3"

From Team Fortress Wiki
Jump to: navigation, search
(playing around with {{Template:Percentage bar}} aka trying to add features)
 
m
Line 13: Line 13:
 
     float:left;
 
     float:left;
 
     line-height:{{{height|12px}}};
 
     line-height:{{{height|12px}}};
     ">{{#if:{{{section2|}}}|{{#expr: {{formatnum:{{{section2}}}|R}} / {{formatnum:{{{total|100}}}|R}} * 100}} %{{{text2|}}}&nbsp;|&nbsp;}}</span><!--  
+
     ">{{#if:{{{section2|}}}|{{#expr:floor( {{formatnum:{{{section2}}}|R}} / {{formatnum:{{{total|100}}}|R}} * 100)}} % {{{text2|}}}&nbsp;|&nbsp;}}</span><!--  
 
   --></div><noinclude>
 
   --></div><noinclude>
 
{{Template doc}}
 
{{Template doc}}
 
[[Category:Templates|Percentage bar]]
 
[[Category:Templates|Percentage bar]]
 
</noinclude>
 
</noinclude>

Revision as of 14:53, 29 December 2010

30%   

Template documentation [view] [edit] [history] [purge]

This template creates an awesome status bar representing the completion percent of anything. By default this template assumes that the bar goes from 0% to 100%, so in use:

{{User:Natemckn/sandbox3|25}}

generates:

25%  

However the top end can be overridden by specifying the total argument, so in this case:

{{User:Natemckn/sandbox3|25|total=200}}

generates:

12%  

As 25 of 200 is 12%, rounded.


You can also add text inside the status bar using "text1"

{{User:Natemckn/sandbox3|25
|text1=completed
|total=200}}

generates:

37% comepleted 

You can also control the light shaded section and add text to it

{{User:Natemckn/sandbox3|20
|text1 = done with thing 1
|section2 = 30
|text2 = done with thing 2
|total = 80}}
generates:
25% done with thing 137% done with thing 2