Difference between revisions of "Template:Ambox"

From Bitcoin Wiki
Jump to: navigation, search
(a new plain consistent ambox from osm.org)
Line 1: Line 1:
<table class="plainlinks ambox {{#ifeq:{{{type|}}}|delete|ambox-delete|}} {{{class|}}}" style="{{{style|}}}"><tr>
+
<table class="metadata plainlinks ambox {{#switch:{{{small|}}}
  {{#if:{{{image|}}}
+
| left = mbox-small-left
     |<!-- Image cell --><td class="ambox-image {{#ifeq:{{{type|}}}|notice|ambox-notice|ambox-{{{type|}}}}}">[[File:{{{image}}}{{!}}{{{imagewidth|56px}}}{{!}}{{{imagealt|}}}]]</td>
+
}} " style="{{{style|}}}margin:0 10%;border:1px solid #AAAAAA;{{#switch:{{{type|}}}
     |<!-- Blank cell if no image specified --><td class="ambox-empty-cell {{#ifeq:{{{type|}}}|notice|ambox-notice|ambox-{{{type|}}}}}"></td>
+
| danger    = background:#FFAAAA;border-left:10px #B22222 solid;
  }}<td class="ambox-text">{{{contents}}}</td>
+
| warning    = background:#FFDDDD;border-left:10px #B22222 solid;
  {{#if:{{{image2|}}}
+
| caution    = background:#FFFFAA;border-left:10px #F28500 solid;
    | <td class="ambox-image2">[[File:{{{image2}}}{{!}}{{{image2width|56px}}}{{!}}{{{image2alt|}}}]]</td>
+
| approval  = background:#DDFFDD;border-left:10px #00FF00 solid;
  }}
+
| proposal  = background:#E4D8FF;border-left:10px #9933CC solid;
</tr></table><!--
+
| detail    = background:#FBFBFB;border-left:10px #F4C430 solid;
// Auto language tracking
+
| protection = background:#FBFBFB;border-left:10px #BBBBAA solid;
-->{{#ifeq:{{NAMESPACE}}|{{ns:0}}|{{auto lang cat}}|}}<!--
+
| notice<!-- = default -->
--><noinclude>
+
| #default  = background:#FBFBFB;border-left:10px #1E90FF solid;
{{Template doc}}
+
}}{{#if:{{{stacked|}}}|border-top:-1px;}}"><tr>
[[Category:Maintenance templates|Ambox]]
+
{{#switch:{{{image|}}}
</noinclude>
+
| blank      <!-- Fall back to "none", since deprecated. -->
 
+
| none     =
{{ambox | type = notice | contents = '''Lorem ipsum''' dolor sit amet.}}
+
  <td class="mbox-empty-cell" style="width:1px;border:none;padding:0;"></td><!-- No image. Cell with some width or padding necessary for text cell to have 100% width. -->
 +
| #default =
 +
  <td class="mbox-image" style="border:none;padding:2px 0 2px 0.9em;text-align:center;">{{#switch:{{{small|}}}
 +
  | left    = <!-- Don't use the DIV -->
 +
  | #default = <div style="width:52px;">
 +
  }}{{#if:{{{image|}}}
 +
  | {{{image}}}
 +
  | [[Image:{{#switch:{{{type|}}}
 +
    | danger    = Ambox warning pn.svg{{!}}Danger
 +
    | warning    = Ambox warning pn.svg{{!}}Warning
 +
    | caution    = Ambox important.svg{{!}}Caution
 +
    | approval  = Thumb up icon.svg{{!}}Approved
 +
    | proposal  = Ambox warning purple.svg{{!}}Proposal
 +
    | detail    = Ambox style.png{{!}}Detail
 +
    | protection = Ambox protection.png{{!}}Protection
 +
     | notice<!-- = default -->
 +
    | #default  = Information icon4.svg{{!}}Information
 +
    }}|{{#switch:{{{small|}}}  
 +
    | left    = 20x20px
 +
    | #default = 40x40px
 +
    }}]]
 +
  }}{{#switch:{{{small|}}}
 +
  | left    = <!-- Don't use the /DIV -->
 +
  | #default = </div>
 +
  }}</td>
 +
}}
 +
<td class="mbox-text" style="{{{textstyle|}}}width:100%;border:none;padding:0.25em 0.9em;text-align:center;">{{{text|}}}</td>
 +
{{#if:{{{imageright|}}}
 +
| {{#ifeq:{{{imageright|}}}|none
 +
  | <!-- No image. -->
 +
  | <td class="mbox-imageright" style="border:none;padding:2px 0.9em 2px 0;text-align:center;">{{#switch:{{{small|}}}
 +
    | left    = {{{imageright|}}}
 +
    | #default = <div style="width:{{{imagerightwidth|52}}}px;">{{{imageright|}}}</div>
 +
    }}</td>
 +
  }}
 +
}}
 +
</tr></table><includeonly>[[Category:Ambox Derived Works|{{PAGENAME}}]]</includeonly><noinclude>{{Documentation}}</noinclude>

Revision as of 19:02, 28 February 2014

This template is used in many pages.

History

This template is a derived work. It is, however, NOT exactly the same as Wikipedia's template of the same name! All CSS has been integrated into the template, and therefore some features are not available. However it is still a very useful template!

Usage Instructions

Example to display a notice:

 {{Ambox
 | type  = notice
 | text  = Hello world!
 }}

The code above should return:

There are lots more examples of ambox use on the Wiki labels page.

Amboxes are divided into various types. Each type should have a corresponding colour code. The colour-coding helps to inform of the severity of the issues at a glance, so you can use the following parameters to change the color of your ambox.