Difference between revisions of "Template:Messagebox"
Jump to navigation
Jump to search
(mark this template with the todo template -- needs to be integrated with new Chameleon skin rather than just the freephile skin) |
(changes background images) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
| warning = message-warning | | warning = message-warning | ||
| failure = message-failure | | failure = message-failure | ||
− | |||
− | |||
| normal <!-- normal = default --> | | normal <!-- normal = default --> | ||
| #default = message-normal | | #default = message-normal | ||
Line 17: | Line 15: | ||
| warning | | warning | ||
| failure | | failure | ||
− | |||
− | |||
| 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 == | == Usage == | ||
The template takes three named parameters that can be given in any order. | The template takes three named parameters that can be given in any order. | ||
; text : (required) is the message | ; text : (required) is the message | ||
; type : (optional) determines the presentation using pre-defined styling. One of | ; type : (optional) determines the presentation using pre-defined styling. One of | ||
− | :* success | + | :* success |
− | :* warning | + | :* warning |
− | :* failure | + | :* failure |
− | |||
− | |||
:* normal (default) | :* normal (default) | ||
; style : (optional) is CSS that will be passed through. | ; style : (optional) is CSS that will be passed through. | ||
− | == Literal | + | == Literal Example == |
<pre> | <pre> | ||
{{Messagebox | {{Messagebox | ||
Line 74: | Line 66: | ||
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Making this template == | == Making this template == | ||
Line 93: | Line 73: | ||
[[Image:Dialog-ok-apply.svg?|32px]] | [[Image:Dialog-ok-apply.svg?|32px]] | ||
[[Image:Dialog-information.svg|32px]] | [[Image:Dialog-information.svg|32px]] | ||
− | |||
− | |||
The parser code (how to do switch statements) is based on the example of the Ambox template from Mediawiki | The parser code (how to do switch statements) is based on the example of the Ambox template from Mediawiki | ||
Line 103: | Line 81: | ||
<source lang="css"> | <source lang="css"> | ||
.message-box { | .message-box { | ||
− | font-family: Verdana, Arial, Helvetica, sans-serif; | + | font-family: Verdana, Arial, Helvetica, sans-serif; |
− | font-size: 11px; | + | font-size: 11px; |
− | background-color:#EBFFEA; | + | background-color:#EBFFEA; |
− | border:1px solid #0BD200; | + | border:1px solid #0BD200; |
− | color:#333333; | + | color:#333333; |
− | padding:8px; | + | padding:8px; |
− | margin:10px; | + | margin:10px; |
− | background-repeat: no-repeat; | + | background-repeat: no-repeat; |
− | background-position: 6px 6px; | + | background-position: 6px 6px; |
} | } | ||
.message-box a:link, .message-box a:active, .message-box a:visited { | .message-box a:link, .message-box a:active, .message-box a:visited { | ||
− | color:#990000; | + | color:#990000; |
− | text-decoration:none; | + | text-decoration:none; |
− | border-bottom:1px solid #cccccc; | + | border-bottom:1px solid #cccccc; |
} | } | ||
.message-box a:hover { | .message-box a:hover { | ||
− | color:#990000; | + | color:#990000; |
− | text-decoration:none; | + | text-decoration:none; |
− | border-bottom:1px solid #990000; | + | border-bottom:1px solid #990000; |
} | } | ||
.message-success { | .message-success { | ||
− | font-weight: bold; | + | font-weight: bold; |
− | border:1px solid #8FD500; | + | border:1px solid #8FD500; |
− | background-color:#F2FFD7; | + | background-color:#F2FFD7; |
− | background-image: url(images/32px-Dialog-ok-apply.svg.png); | + | background-image: url(images/32px-Dialog-ok-apply.svg.png); |
− | padding-left: 32px; | + | padding-left: 32px; |
} | } | ||
.message-failure { | .message-failure { | ||
− | font-weight: bold; | + | font-weight: bold; |
− | color: #990000; | + | color: #990000; |
− | border:1px solid #DD3C10; | + | border:1px solid #DD3C10; |
− | background-color:#FFEBE8; | + | background-color:#FFEBE8; |
− | background-image: url(images/32px-Dialog-error.svg.png); | + | background-image: url(images/32px-Dialog-error.svg.png); |
− | padding-left: 32px; | + | padding-left: 32px; |
} | } | ||
.message-warning { | .message-warning { | ||
− | font-weight: bold; | + | font-weight: bold; |
− | color:#FF6633; | + | color:#FF6633; |
− | border: 1px solid #ff9900; | + | border: 1px solid #ff9900; |
− | background-color:#fbf8c7; | + | background-color:#fbf8c7; |
− | background-image: url(images/32px-Dialog-warning.svg.png); | + | background-image: url(images/32px-Dialog-warning.svg.png); |
− | padding-left: 32px; | + | padding-left: 32px; |
} | } | ||
.message-box .message-normal { | .message-box .message-normal { | ||
− | font-weight:normal; | + | font-weight:normal; |
− | color: #333; | + | color: #333; |
− | background-image: url(images/32px-Dialog-information.svg.png); | + | background-image: url(images/32px-Dialog-information.svg.png); |
− | padding-left: 32px; | + | padding-left: 32px; |
} | } | ||
</source> | </source> |
Revision as of 21:47, 3 January 2009
Usage[edit source]
The template takes three named parameters that can be given in any order.
- text
- (required) is the message
- type
- (optional) determines the presentation using pre-defined styling. One of
- success
- warning
- failure
- normal (default)
- style
- (optional) is CSS that will be passed through.
Literal Example[edit source]
{{Messagebox | type = success | style = width:50%; | text = your message content }}
For a more complex (up to 80 parameters) template, see the Infobox template Template_talk:Infobox
Visual Examples[edit source]
Making this template[edit source]
To generate the resized images from svg 32px
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
.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/32px-Dialog-ok-apply.svg.png);
padding-left: 32px;
}
.message-failure {
font-weight: bold;
color: #990000;
border:1px solid #DD3C10;
background-color:#FFEBE8;
background-image: url(images/32px-Dialog-error.svg.png);
padding-left: 32px;
}
.message-warning {
font-weight: bold;
color:#FF6633;
border: 1px solid #ff9900;
background-color:#fbf8c7;
background-image: url(images/32px-Dialog-warning.svg.png);
padding-left: 32px;
}
.message-box .message-normal {
font-weight:normal;
color: #333;
background-image: url(images/32px-Dialog-information.svg.png);
padding-left: 32px;
}