cogCustom displayer for User properties
TypeSnippet
Category
Developed by

Vincent Massol

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

While waiting for XWIKI-4022 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}}

Example

When you edit your page in inline mode you'll see for example:

usercustomdisplay1.png

And if you use a Livetable with a column displaying a List of Users you'll get:

usercustomdisplay2.png

Tags:
     

Get Connected