Template:WarnAlt: Difference between revisions

From Caps Wiki
Jump to navigation Jump to search
(The subpages are elegant but make adjusting the styling of the different sized messages en masse difficult. Adding .warning, .caution etc entries to MediaWiki:Common.css or installing TemplateStyles would be ideal)
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 13: Line 13:
| caution=f1cc43
| caution=f1cc43
| note|custom=4666c8
| note|custom=4666c8
}};"><table><tr><td>[[File:{{#switch: {{{severity| {{{1}}} }}}
}}; border-top-width: 0.4em;"><table><tr><td>[[File:{{#switch: {{{severity| {{{1}}} }}}
<!-- large box icons -->
<!-- large box icons -->
| danger=OOjs UI icon alert-destructive.svg
| danger=OOjs UI icon alert-destructive.svg
Line 20: Line 20:
| note=OOjs UI icon information-progressive.svg
| note=OOjs UI icon information-progressive.svg
| custom={{{custom_icon}}}
| custom={{{custom_icon}}}
}}|35px|left|link=|alt={{{severity}}}]]</td><td>'''{{#switch: {{{severity| {{{1}}} }}}
}}|35px|left|link=|alt={{{severity| {{{1}}} }}}]]</td><td>{{#switch: {{{severity| {{{1}}} }}}
<!-- large box labels -->
<!-- large box labels -->
| danger=DANGER
| danger='''DANGER'''
| warning=WARNING
| warning='''WARNING'''
| caution=CAUTION
| caution='''CAUTION'''
| note=NOTE
| note='''NOTE'''
| custom={{{custom_label}}}
| custom={{{custom_label}}}
}}''' {{{message| {{{3|}}} }}}</td></div>
}} {{{message| {{{3|}}} }}}</td></tr></table></div>
| medium|med=<table style="padding: 0.5em; background-color: #{{#switch: {{{severity| {{{1}}} }}}
| medium|med=<table style="padding: 0.5em; margin-top: 0.5em; background-color: #{{#switch: {{{severity| {{{1}}} }}}
<!-- medium box background colors -->
<!-- medium box background colors -->
| danger=fee7e6
| danger=fee7e6
Line 47: Line 47:
| note=OOjs UI icon information-progressive.svg
| note=OOjs UI icon information-progressive.svg
| custom={{{custom_icon}}}
| custom={{{custom_icon}}}
}}|18px|text-bottom|link=|alt={{{severity}}}]] '''{{#switch: {{{severity| {{{1}}} }}}
}}|18px|text-bottom|link=|alt={{{severity| {{{1}}} }}}]] {{#switch: {{{severity| {{{1}}} }}}
<!-- medium box labels -->
<!-- medium box labels -->
| danger=DANGER
| danger='''DANGER'''
| warning=WARNING
| warning='''WARNING'''
| caution=CAUTION
| caution='''CAUTION'''
| note=NOTE
| note='''NOTE'''
| custom={{{custom_label}}}
| custom={{{custom_label}}}
}}''' {{{message| {{{3|}}} }}}</table>
}} {{{message| {{{3|}}} }}}</table>
| small=[[File:{{#switch: {{{severity| {{{1}}} }}}
| small=[[File:{{#switch: {{{severity| {{{1}}} }}}
<!-- small box icons -->
<!-- small box icons -->
Line 62: Line 62:
| note=OOjs UI icon information-progressive.svg
| note=OOjs UI icon information-progressive.svg
| custom={{{custom_icon}}}
| custom={{{custom_icon}}}
}}|18px|text-bottom|link=|alt={{{severity}}}]] '''{{#switch: {{{severity| {{{1}}} }}}
}}|18px|text-bottom|link=|alt={{{severity| {{{1}}} }}}]] {{#switch: {{{severity| {{{1}}} }}}
| danger=DANGER
<!-- small box labels -->
| warning=WARNING
| danger='''DANGER'''
| caution=CAUTION
| warning='''WARNING'''
| note=NOTE
| caution='''CAUTION'''
| note='''NOTE'''
| custom={{{custom_label}}}
| custom={{{custom_label}}}
}}''' {{{message| {{{3|}}} }}}
}} {{{message| {{{3|}}} }}}
}}<noinclude><templatedata>
}}<noinclude>
{
{{/doc}}[[Category:Warning Templates]]</noinclude>
"params": {
"severity": {
"label": "Severity and Color",
"description": "The severity of the warning that will also determine the color of the warning.",
            "suggestedvalues": [
      "danger",
              "warning",
      "caution",
      "note",
      "custom"
        ],
"type": "string",
"required": true,
            "aliases": [ "1" ]
},
"size": {
"label": "Warning Box Size",
"description": "The size or type of the warning to be created.",
            "suggestedvalues": [
      "large",
              "medium",
      "small"
        ],
"type": "string",
"required": true,
            "aliases": [ "2" ]
},
"message": {
"label": "Displayed Text",
"description": "The text to be displayed in the warning box.",
"example": "Caps may retain charge after poweroff",
"type": "string",
"required": false,
            "aliases": [ "3" ]
},
"custom_label": {
"label": "Custom Label",
"description": "A custom label to be displayed before the message in boldface. Required when ''severity'' is set to ''custom''.",
"example": "ACHTUNG",
"type": "string",
"required": false
},
"custom_icon": {
"label": "Custom Icon",
"description": "An image file to be displayed as an icon before the label. Required when ''severity'' is set to ''custom''. Do not include ''File:''. Since the custom option displays in a blue theme, blue-colored icons are suggested.",
"example": "OOjs UI icon laptop-progressive.svg",
"type": "string",
"required": false
}
},
"description": "Create a warning box to get the users attention"
}
</templatedata>
[[Category:Warning Templates]]</noinclude>

Latest revision as of 22:23, 17 February 2022

Error: The severity and size arguments are required.

Documentation

This template is an intended replacement for the {{warn}} template. It has four different severity levels and three different sizes, which are demonstrated here.

Syntax

For the source editor, the syntax is {{WarnAlt|<note|caution|warning|danger>|<large|medium/med|small>|<message>}}.
The visual editor provides a nice popup box where you can fill in all the data, but the same arguments apply.

TemplateData

Create a warning box to get the users attention

[Edit template data]

Template parameters

ParameterDescriptionTypeStatus
Severity and Colorseverity 1

The severity of the warning that will also determine the color of the warning.

Example
danger, warning, caution, note, custom
Stringrequired
Warning Box Sizesize 2

The size or type of the warning to be created.

Example
large, medium, small
Stringrequired
Displayed Textmessage 3

The text to be displayed in the warning box.

Example
Caps may retain charge after poweroff
Stringrequired
Custom Labelcustom_label

A custom label to be displayed before the message. Required when ''severity'' is set to ''custom''.

Example
ACHTUNG
Stringoptional
Custom Iconcustom_icon

An image file to be displayed as an icon before the label. Required when ''severity'' is set to ''custom''. Do not include ''File:''. Since the custom option displays in a blue theme, blue-colored icons are suggested.

Example
OOjs UI icon laptop-progressive.svg
Stringoptional