Template:Messagebox/doc: Difference between revisions

No edit summary
Add Template Data
 
(3 intermediate revisions by the same user not shown)
Line 26: Line 26:


== Visual Examples ==
== Visual Examples ==
<pre>
{{Messagebox
{{Messagebox
| text = no type, uses default (normal)
| text = no type, uses default (normal)
| style = width:50%;
| style = width:50%;
}}
}}
</pre>
{{Messagebox
| text = no type, uses default (normal)
| style = width:50%;
}}


<pre>
{{Messagebox
| type = normal
| text = Why be normal?
}}
</pre>
{{Messagebox
{{Messagebox
| type = normal
| type = normal
Line 36: Line 49:
}}
}}


<pre>
{{Messagebox
| type = success
| text = You won!
}}
</pre>
{{Messagebox
{{Messagebox
| type = success
| type = success
Line 41: Line 60:
}}
}}


<pre>
{{Messagebox
| type = warning
| text = Do not spit into the wind
}}
</pre>
{{Messagebox
{{Messagebox
| type = warning
| type = warning
Line 46: Line 71:
}}
}}


<pre>
{{Messagebox
{{Messagebox
|type = failure
|type = failure
|text = You kissed your cousin
|text = Something went wrong.
}}
</pre>
{{Messagebox
|type = failure
|text = Something went wrong.
}}
}}


<pre>
{{Messagebox
{{Messagebox
| type = forbidden
| type = forbidden
Line 56: Line 88:
}}
}}


</pre>
{{Messagebox
| type = forbidden
| text = You can't do that!
}}
<pre>
{{Messagebox
| type = restricted
| text = You must be a registered user to create or edit articles.  Contact the [[User:Freephile|WikiSysop]] for an account!
}}
</pre>
{{Messagebox
{{Messagebox
| type = restricted
| type = restricted
Line 62: Line 106:


== Making this template ==
== Making this template ==
To generate the resized images from svg
[[Image:Dialog-error.svg|20px]]
[[Image:Dialog-warning.svg|20px]]
[[Image:Dialog-ok-apply.svg|20px]]
[[Image:Dialog-information.svg|20px]]
[[Image:Dialog-cancel.svg|20px]]
[[Image:Dialog-password.svg|20px]]


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


The CSS is added to {{PAGENAME}}/styles.css to make this template complete by incorporating the TemplateStyles extension.
The CSS is added to [[Template:Messagebox/styles.css]] to make this template complete by incorporating the TemplateStyles extension.


<syntaxhighlight lang="css">
[[Category:Templates using ParserFunctions]]
.message-box {
<templatedata>
font-family: Verdana, Arial, Helvetica, sans-serif;
{
font-size: 11px;
"params": {
background-color:#EBFFEA;
"type": {
border:1px solid #0BD200;
"label": "Type of box",
color:#333333;
"description": "Type determines the decoration of the message box",
padding:8px;
"type": "string",
margin:10px;
"suggestedvalues": [
background-repeat: no-repeat;
"success",
background-position: 6px 6px;
"warning",
"failure",
" restricted",
"forbidden",
"normal"
],
"default": "normal"
},
"style": {
"label": "CSS markup",
"description": "Add CSS if desired. This will be passed to the \"style\" attribute of the containing div.",
"example": "width:50%;",
"type": "string"
},
"text": {
"label": "Your message",
"description": "The text (and wiki markup) displayed in the message box.",
"type": "string",
"required": true
}
},
"description": "Messagebox is for creating call-outs of text in a bordered box. This visually distinguishes the text from other content on the page. There are multiple \"types\" that are predefined - basically red, yellow green.",
"format": "block"
}
}
.message-box a:link, .message-box a:active, .message-box a:visited {
</templatedata>
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;
padding-left: 32px;
}
.message-failure {
font-weight: bold;
color: #990000;
border:1px solid #DD3C10;
background-color:#FFEBE8;
padding-left: 32px;
}
.message-warning {
font-weight: bold;
color:#FF6633;
border: 1px solid #ff9900;
background-color:#fbf8c7;
padding-left: 32px;
}
.message-box .message-normal {
font-weight:normal;
color: #333;
padding-left: 32px;
}
</syntaxhighlight>
[[Category:Templates using ParserFunctions]]