Conditional formatting according to properties
Hello, (this question was first raised in the wrong place here):
Is there a simple way of adding conditional formatting to a template that gets filled with a form and annotated properties? Let's say, there is a property:has Priority, and priority A should color the section red, B orange, C yellow… and so on. I've searched and tried a lot, but only found info about conditional formatting for tables.
Goal is to let the user choose an option within a form (+ template) and according to the answer display a certain formatting.
I guess, it's not going to work with the #if
parser function, instead I've tried to use #switch
like this:
<div style="background-color:#{{#switch:{{{Priority}}} |#A = faa8a8 |B = facba8 |C = faf1a8 |#default = e1e4e2}};"> … </div>
It's not reacting at all, if within <span>
tags, but gives out the value of #default
, when within <div>
tags. (I fear I might have totally misunderstood the concept here?)
MediaWiki uses something like this in the Extension template, but it's hard to make out the relevant parts...
I would be happy about any hints pointing me in the right direction.