Module: alfresco/renderers/AvatarThumbnail

alfresco/renderers/AvatarThumbnail

This extends the standard thumbnail widget to render user avatar thumbnails. By default, it has no click action, however it is possible to specify a custom publishTopic which will then render the thumbnail clickable. For more information, please see the example below.

The Alfresco REST APIs greatly vary in the attribute that user names are assigned to so it is important when using this widget to set the userNameProperty for the context in which the thumbnail is to be used. If the REST API supports it you should also look to set the imageTitleProperty to the full name of the user

Author:
  • Dave Draper
License:
Source:

Examples

Example configuration to set a specific user name and title properties:

{
   "name": "alfresco/renderers/AvatarThumbnail",
   "config": {
      "userNameProperty": "user",
      "imageTitleProperty": "displayName"
   }
}

Example configuration with click/publish:

{
   name: "alfresco/renderers/AvatarThumbnail",
   id: "GUEST_THUMBNAIL",
   config: {
      currentItem: {
         userName: "guest"
      },
      publishTopic: topics.DISPLAY_NOTIFICATION,
      publishPayload: {
         message: "You clicked on the guest thumbnail"
      },
      publishGlobal: true
   }
}

Members

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/AvatarThumbnail.css"}]
Source:

customClasses :string

Adds the "alfresco-renderers-AvatarThumbnail" CSS class the main DOM node defined in the template
Type:
  • string
Default Value:
  • "alfresco-renderers-AvatarThumbnail"
Source:

groupImage :string

The name of the group image to use.
Type:
  • string
Since:
  • 1.0.75
Default Value:
  • "group-64.png"
Source:

groupProperty :string

A dot-notation property of the currentItem that can be used to determine whether or not it represents a group. This property is then matched against the values in the groupValues.
Type:
  • string
Since:
  • 1.0.75
Default Value:
  • null
Source:

groupValues :string[]

An array of the values that the groupProperty of the currentItem can match to indicate that it represents group (rather than a user).
Type:
  • string[]
Since:
  • 1.0.75
Default Value:
  • null
Source:

isGroup :boolean

A property indicating whether or not the currentItem represents a group or not. This can be determined by configuring the groupProperty and groupValues attributes, but it can be set directly if required.
Type:
  • boolean
Since:
  • 1.0.75
Default Value:
  • false
Source:

userNameProperty :string

Use the to set the attribute in the currentItem object that maps to the user name of the of the user that should have their avatar displayed. This is used in the generated thumbnailUrlTemplate to define the URL to retrieve the thumbnail from. Be aware that the default thumbnailUrlTemplate will support user nodeRef values as well as user names.
Type:
  • string
Default Value:
  • "userName"
Source:

Methods

postCreate()

Called after widget has been created.
Source:

postMixInProperties()

Sets a URL template for retrieving the user avatar thumbnail if one has not been configured. It is possible to explicitly set a thumbnailUrlTemplate which will stop the default from being set, but it is simpler to just configure the userNameProperty instead.
Source:

<inner> onLinkClick(evt)

Overrides the inherited function to prevent click actions from having any effect unless a publishTopic has been specified.
Parameters:
Name Type Description
evt object The click event
Source: