User:Lariat2301/SandBox3

From The Urban Dead Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

See: Sand Pit, Sand Box, SandBox2 and SandBox3.

Our goal is to create the simplest template which, when aimed at an existing DangerReport, produces a tiny color-coded box signaling that building's latest known condition.

A later goal will be to include a hover tooltip that provides additional details, such as:

  • the name and coordinates of the building;
  • the date of the report.

The current version still depends on various StatusMap templates, such as Template:StatusMap unknown and Template:StatusMap safe. There might be better ways of doing this, such as with a Template:Switch statement. I found an example if its usage at the right side, here.

The old source:

{| style="width:7px; height:7px; background:{{StatusMap {{{status|unknown}}}}}" | <!-- Hah! Nothing in the box! -->
|}

The new source, using the switch:

{| style="width:7px; height:7px; background:{{switch
|{{{status|unknown}}}
|case: safe=green
|case: under attack=yellow         <!-- should be #EE0 -->
|case: under siege=orange          <!-- should be #F80 -->
|case: ransacked=DarkRed           <!-- should be #BE3939 -->
|case: ruined=DarkRed              <!-- should be #BE3939 -->
|case: in zombie hands=red
|case: rebuilding=Lime             <!-- should be #60BF60 -->
|case: rot revive=DarkOliveGreen   <!-- should be #630 -->
|default=gray <!-- aka unknown -->
}}" | <!-- Hah! Nothing in the box! -->
|}

The current default for the variable {{{status}}} is "unknown", thus the result will be the gray box below: