Template:Alert box: Difference between revisions

From CETAF ISTC Wiki
bwf>Andreas Plank
(Alert box after CodiMD layout)
 
bwf>Andreas Plank
m (+anchor visible)
 
Line 2: Line 2:
   template programming here
   template programming here
  -->{{#switch: {{LC:{{{type|{{{2|}}}}}}}}<!--
  -->{{#switch: {{LC:{{{type|{{{2|}}}}}}}}<!--
-->| danger = <div class="alert alert-danger" {{#if: {{{anchor|}}}|id="{{{anchor|}}}"}} style="/* .alert */ padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; /* .alert-danger */ color: #a94442; background-color: #f2dede; border-color: #ebccd1; ">{{{1|{{{content|}}}}}}</div><!--
-->| danger = <div class="alert alert-danger" {{#if: {{{anchor|}}}|id="{{{anchor|}}}"}} style="/* .alert */ padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; /* .alert-danger */ color: #a94442; background-color: #f2dede; border-color: #ebccd1; ">{{#if: {{{anchor|}}}|<div class="mw-collapsible mw-collapsed" style="border-bottom:1px solid gray;margin-bottom:1ex;" id="mw-customcollapsible-{{#REPLACE:{{ANCHORENCODE:{{{anchor|}}}}}|.|dot}}" ><span title="Click to show the link anchor to this box" class="mw-customtoggle-{{#REPLACE:{{ANCHORENCODE:{{{anchor|}}}}}|.|dot}}">&#x1F517;</span><div class="mw-collapsible-content">Link to this box: [[#{{{anchor|}}}]]</div></div>}}<!--
-->| info | #default = <div class="alert alert-info" {{#if: {{{anchor|}}}|id="{{{anchor|}}}"}} style="/* .alert */ padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; /* .alert-info */ color: #31708f; background-color: #d9edf7; border-color: #bce8f1; ">{{{1|{{{content|}}}}}}</div><!--
  -->{{{1|{{{content|}}}}}}</div><!--
-->| success = <div class="alert alert-success" {{#if: {{{anchor|}}}|id="{{{anchor|}}}"}} style="/* .alert */ padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; /* .alert-success */ color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; ">{{{1|{{{content|}}}}}}</div><!--
-->| info | #default = <div class="alert alert-info" {{#if: {{{anchor|}}}|id="{{{anchor|}}}"}} style="/* .alert */ padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; /* .alert-info */ color: #31708f; background-color: #d9edf7; border-color: #bce8f1; ">{{#if: {{{anchor|}}}|<div class="mw-collapsible mw-collapsed" style="border-bottom:1px solid gray;margin-bottom:1ex;" id="mw-customcollapsible-{{#REPLACE:{{ANCHORENCODE:{{{anchor|}}}}}|.|dot}}" ><span title="Click to show the link anchor to this box" class="mw-customtoggle-{{#REPLACE:{{ANCHORENCODE:{{{anchor|}}}}}|.|dot}}">&#x1F517;</span><div class="mw-collapsible-content">Link to this box: [[#{{{anchor|}}}]]</div></div>}}<!--
-->| warning = <div class="alert alert-warning" {{#if: {{{anchor|}}}|id="{{{anchor|}}}"}} style="/* .alert */ padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; /* .alert-warning */ color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc; ">{{{1|{{{content|}}}}}}</div><!--
  -->{{{1|{{{content|}}}}}}</div><!--
-->| success = <div class="alert alert-success" {{#if: {{{anchor|}}}|id="{{{anchor|}}}"}} style="/* .alert */ padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; /* .alert-success */ color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; ">{{#if: {{{anchor|}}}|<div class="mw-collapsible mw-collapsed" style="border-bottom:1px solid gray;margin-bottom:1ex;" id="mw-customcollapsible-{{#REPLACE:{{ANCHORENCODE:{{{anchor|}}}}}|.|dot}}" ><span title="Click to show the link anchor to this box" class="mw-customtoggle-{{#REPLACE:{{ANCHORENCODE:{{{anchor|}}}}}|.|dot}}">&#x1F517;</span><div class="mw-collapsible-content">Link to this box: [[#{{{anchor|}}}]]</div></div>}}<!--
  -->{{{1|{{{content|}}}}}}</div><!--
-->| warning = <div class="alert alert-warning" {{#if: {{{anchor|}}}|id="{{{anchor|}}}"}} style="/* .alert */ padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; /* .alert-warning */ color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc; ">{{#if: {{{anchor|}}}|<div class="mw-collapsible mw-collapsed" style="border-bottom:1px solid gray;margin-bottom:1ex;" id="mw-customcollapsible-{{#REPLACE:{{ANCHORENCODE:{{{anchor|}}}}}|.|dot}}" ><span title="Click to show the link anchor to this box" class="mw-customtoggle-{{#REPLACE:{{ANCHORENCODE:{{{anchor|}}}}}|.|dot}}">&#x1F517;</span><div class="mw-collapsible-content">Link to this box: [[#{{{anchor|}}}]]</div></div>}}<!--
  -->{{{1|{{{content|}}}}}}</div><!--
-->}}<!-- end switch
-->}}<!-- end switch
--></includeonly><noinclude>
--></includeonly><noinclude>
Line 26: Line 30:
  |Note, that text in the box (info notice is default style)
  |Note, that text in the box (info notice is default style)
  |info
  |info
}}
<nowiki>{{</nowiki>{{PAGENAME}}
|Note, that text in the box (info notice is default style)
|anchor=box with info note
  }}
  }}


Line 34: Line 43:
  |Note, that text in the box (info notice is default style)
  |Note, that text in the box (info notice is default style)
  |info
  |info
}}
{{ {{PAGENAME}}
|Note, that text in the box (info notice is default style)
|anchor=box with info note
}}
}}
</td><!--
</td><!--

Latest revision as of 12:45, 13 July 2020

Summary: provide different kind of display boxes for messages (e.g. info, warning, danger, success)

Usage

Wiki CodeExample
{{Alert box
|Note, that text in the box (info notice is default style)
}}
{{Alert box
|Note, that text in the box (info notice is default style)
|info
}}
{{Alert box
|Note, that text in the box (info notice is default style)
|anchor=box with info note
}}

… which gives

Note, that text in the box (info notice is default style)
🔗
Link to this box: #box with info note
Note, that text in the box (info notice is default style)
{{Alert box
|Yes, text in the box (success notice)
|success
}}

… which gives

Yes, text in the box (success notice)
{{Alert box
|Watch out! Text in the box (warning notice)
|warning
}}

… which gives

Watch out! Text in the box (warning notice)
{{Alert box
|Oh No! Text in the box (danger notice)
|danger
}}

… which gives

Oh No! Text in the box (danger notice)

Parameters

Bold parameters are mandatory, all other are optional:

|1= or |content=
the text content of the box
|2= or |type=
the text content of the box’es type, one of info, success, warning, danger (info is default)
|anchor=
an (HTML) ID as a target anchor, to have later a link possibility to point to this ID