Template:WarnAlt: Difference between revisions

From Caps Wiki
Jump to navigation Jump to search
m (Add templatedata on parameters)
No edit summary
 
(33 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!--This template is just selection logic. The actual dialogs are all stored in subpages.-->
{{#switch: {{{size | {{{2|}}} }}}
{{#switch: {{{severity| {{{1|}}} }}}
| #default = {{error|The severity and size arguments are required.}}
| #default = The severity argument is required.
| large=<div style="padding: 1.2em; margin-top: 0.5em; border-top-width: 0.4em; border-radius: 0.20em; box-shadow: 2px 2px #F7F8F9; background-color: #{{#switch: {{{severity| {{{1}}} }}}
| note|1 = {{User:lyiriyah/sandbox/warn/note| {{{size| {{{2|}}} }}} | {{{message| {{{3|}}} }}} }}
<!-- large box background colors -->
| caution|2 = {{User:lyiriyah/sandbox/warn/caution| {{{size| {{{2|}}} }}} | {{{message| {{{3|}}} }}} }}
| danger=fee7e6
| warning|3 = {{User:lyiriyah/sandbox/warn/warning| {{{size| {{{2|}}} }}} | {{{message| {{{3|}}} }}} }}
| warning=fceee6
| danger|4 = {{User:lyiriyah/sandbox/warn/danger| {{{size| {{{2|}}} }}} | {{{message| {{{3|}}} }}} }}
| caution=fcf8e6
}}
| note|custom=f8f9fa
<noinclude>
}}; border: 1px solid #{{#switch: {{{severity| {{{1}}} }}}
{{WarnAlt/doc}}
<!-- large box border colors -->
<templatedata>
| danger=bf3333
{
| warning=df5c15
"params": {
| caution=f1cc43
"Size": {
| note|custom=4666c8
"label": "Warning Box Size",
}}; border-top-width: 0.4em;"><table><tr><td>[[File:{{#switch: {{{severity| {{{1}}} }}}
"description": "The size or type of the warning to be created",
<!-- large box icons -->
"example": "Full, Small, Line",
| danger=OOjs UI icon alert-destructive.svg
"type": "string",
| warning=OOjs UI icon alert-warning.svg
"default": "Full",
| caution=OOjs UI icon alert-yellow.svg
"deprecated": true,
| note=OOjs UI icon information-progressive.svg
"required": true
| custom={{{custom_icon}}}
},
}}|35px|left|link=|alt={{{severity| {{{1}}} }}}]]</td><td>{{#switch: {{{severity| {{{1}}} }}}
"Severity": {
<!-- large box labels -->
"label": "Severity and Color",
| danger='''DANGER'''
"description": "The severity of the warning that will also determine the color of the warning. ",
| warning='''WARNING'''
"example": "Danger, Caution, Note",
| caution='''CAUTION'''
"type": "string",
| note='''NOTE'''
"default": "Caution",
| custom={{{custom_label}}}
"required": true
}} {{{message| {{{3|}}} }}}</td></tr></table></div>
},
| medium|med=<table style="padding: 0.5em; margin-top: 0.5em; background-color: #{{#switch: {{{severity| {{{1}}} }}}
"Message": {
<!-- medium box background colors -->
"label": "Displayed Text",
| danger=fee7e6
"description": "The text to be displayed in the warning box",
| warning=fceee6
"example": "Caps may retain charge after poweroff",
| caution=fcf8e6
"type": "string",
| note|custom=f8f9fa
"required": true
}}; border: 1px solid #{{#switch: {{{severity| {{{1}}} }}}
}
<!-- medium box border colors -->
},
| danger=bf3333
"description": "Create a warning box to get the users attention"
| warning=df5c15
}
| caution=f1cc43
</templatedata></noinclude>
| note|custom=4666c8
}};"><tr><td nowrap="true">[[File:{{#switch: {{{severity| {{{1}}} }}}
<!-- medium box icons -->
| danger=OOjs UI icon alert-destructive.svg
| warning=OOjs UI icon alert-warning.svg
| caution=OOjs UI icon alert-yellow.svg
| note=OOjs UI icon information-progressive.svg
| custom={{{custom_icon}}}
}}|18px|text-bottom|link=|alt={{{severity| {{{1}}} }}}]] {{#switch: {{{severity| {{{1}}} }}}
<!-- medium box labels -->
| danger='''DANGER'''
| warning='''WARNING'''
| caution='''CAUTION'''
| note='''NOTE'''
| custom={{{custom_label}}}
}} {{{message| {{{3|}}} }}}</table>
| small=[[File:{{#switch: {{{severity| {{{1}}} }}}
<!-- small box icons -->
| danger=OOjs UI icon alert-destructive.svg
| warning=OOjs UI icon alert-warning.svg
| caution=OOjs UI icon alert-yellow.svg
| note=OOjs UI icon information-progressive.svg
| custom={{{custom_icon}}}
}}|18px|text-bottom|link=|alt={{{severity| {{{1}}} }}}]] {{#switch: {{{severity| {{{1}}} }}}
<!-- small box labels -->
| danger='''DANGER'''
| warning='''WARNING'''
| caution='''CAUTION'''
| note='''NOTE'''
| custom={{{custom_label}}}
}} {{{message| {{{3|}}} }}}
}}<noinclude>
{{/doc}}[[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