User Property Custom Display
Last modified by Manuel Smeria on 2021/03/18 11:29
Custom displayer for User properties |
Type | Snippet |
Category | |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
While waiting for to get implemented here's how you could have a nicer User property display.
Edit your List of Users property class field using the Class Editor and in the Custom Display field, type:
{{velocity}}
#set ($propertyClass = $object.getxWikiClass().get($name))
#if ($type == 'edit')
{{html clean=false}}
$doc.displayEdit($propertyClass, $prefix, $object).replaceAll("value='[^']*+' size=", "value='$!{valueString}' size=")
{{/html}}
#else
#foreach($v in $value.split(','))
[[{{useravatar username="$v" height="40"/}}>>$v]] #end
#end
{{/velocity}}
#set ($propertyClass = $object.getxWikiClass().get($name))
#if ($type == 'edit')
{{html clean=false}}
$doc.displayEdit($propertyClass, $prefix, $object).replaceAll("value='[^']*+' size=", "value='$!{valueString}' size=")
{{/html}}
#else
#foreach($v in $value.split(','))
[[{{useravatar username="$v" height="40"/}}>>$v]] #end
#end
{{/velocity}}
Example
When you edit your page in inline mode you'll see for example:
And if you use a Livetable with a column displaying a List of Users you'll get: