|
|
| (10 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| | <templatestyles src="Messagebox/styles.css" /> |
| <div class="message-box | | <div class="message-box |
| {{#switch:{{{type|}}} | | {{#switch:{{{type}}} |
| | success = message-success | | | success = message-success |
| | warning = message-warning | | | warning = message-warning |
| | failure = message-failure | | | failure = message-failure |
| | | restricted = message-restricted |
| | | forbidden = message-forbidden |
| | normal <!-- normal = default --> | | | normal <!-- normal = default --> |
| | #default = message-normal | | | #default = message-normal |
| }}" style="{{{style|}}}"> | | }}" style="{{{style|}}}"> |
| | {{#switch:{{{type}}} |
| | | success = [[File:Dialog-ok-apply.svg|20px]] |
| | | warning = [[File:Dialog-warning.svg|20px]] |
| | | failure = [[File:Dialog-error.svg|20px]] |
| | | restricted = [[File:Dialog-password.svg|20px]] |
| | | forbidden = [[File:Dialog-cancel.svg|20px]] |
| | | normal |
| | | #default = [[File:Dialog-information.svg|20px]] |
| | }} |
| {{{text}}} | | {{{text}}} |
| </div> | | </div> |
| Line 15: |
Line 27: |
| | warning | | | warning |
| | failure | | | failure |
| | | restricted |
| | | forbidden |
| | normal = <!-- Do nothing, valid "type" --> | | | normal = <!-- Do nothing, valid "type" --> |
| | #default = <div style="text-align: center;">This message box is using an invalid "type={{{type|}}}" parameter and needs fixing. ([[:Category:templates using deprecated types|learn more]])</div><!-- Sort on namespace --> | | | #default = <div style="text-align: center;">This message box is using an invalid "type={{{type|}}}" parameter and needs fixing. ([[:Category:templates using deprecated types|learn more]])</div><!-- Sort on namespace --> |
| }} | | }} |
| <noinclude> | | <noinclude> |
| == Usage ==
| | {{Documentation}}</noinclude> |
| The template takes two named parameters. '''type''' is optional
| |
| | |
| <pre>
| |
| {{Messagebox | |
| |type = success (or warning, failure, normal) can be left blank
| |
| |text = your message content
| |
| }} | |
| </pre>
| |
| | |
| For a more complex (up to 80 parameters) template, see the Infobox template [[Template_talk:Infobox]]
| |
| | |
| == Examples ==
| |
| {{Messagebox
| |
| |text = no type, uses default (normal)
| |
| }}
| |
| | |
| {{Messagebox
| |
| |type = normal
| |
| |text = Why be normal?
| |
| }}
| |
| | |
| {{Messagebox
| |
| |type = success
| |
| |text = You won!
| |
| }}
| |
| | |
| {{Messagebox
| |
| |type = warning
| |
| |text = Do not spit into the wind
| |
| }}
| |
| | |
| {{Messagebox
| |
| |type = failure
| |
| |text = You kissed your cousin
| |
| }}
| |
| | |
| | |
| == Making this template ==
| |
| The parser code (how to do switch statements) is based on the example of the Ambox template from Mediawiki
| |
| | |
| The following CSS is added to skins/freephile/freephile_template.css to make this template complete
| |
| | |
| The background images for the CSS are put into the images subfolder to make it easier to distinguish what is based on monobook, and what is extra
| |
| <source lang="css">
| |
| .message-box {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; background-color:#EBFFEA; border:1px solid #0BD200; color:#333333; padding:8px; margin:10px;background-repeat: no-repeat;background-position: 6px 6px;}
| |
| .message-box a:link, .message-box a:active, .message-box a:visited {color:#990000;text-decoration:none;border-bottom:1px solid #cccccc;}
| |
| .message-box a:hover {color:#990000;text-decoration:none;border-bottom:1px solid #990000;}
| |
| .message-success {font-weight: bold;border:1px solid #8FD500; background-color:#F2FFD7; background-image: url(images/check.gif);padding-left: 28px;}
| |
| .message-failure {font-weight: bold; color: #990000; border:1px solid #DD3C10; background-color:#FFEBE8; background-image: url(images/wrong.gif);padding-left: 28px;}
| |
| .message-warning {font-weight: bold;color:#FF6633;border: 1px solid #ff9900; background-color:#fbf8c7; background-image: url(images/warning_sign.gif);padding-left: 28px;}
| |
| .message-box .message-normal {font-weight:normal;color: #333;}
| |
| </source>
| |
| </noinclude> | |
| | |
| [[Category:Templates using ParserFunctions]]
| |