Show:

Users avatar Class

Avatar representing a user

Constructor

Users avatar

(
  • prefix
  • [options]
  • [options.templates.icon.fields.alt="user
)

Parameters:

  • prefix String

    Prefix of the tool to be constructed.

  • [options] Object optional

    A hash of options, containing:

    • userId String

      The id of the user object. Defaults to id of the logged-in user, if any. Can be '' for a blank-looking avatar.

    • [icon=Q.Users.icon.defaultSize] Number | String | True optional

      Size of the icon to render before the display name. Or 0 for no icon. You can also pass true here for default size. Or pass a string to specify the url of the icon.

    • [contents=true] Boolean optional

      Set to false to not show the name

    • [short=false] Boolean optional

      If true, renders the short version of the display name.

    • [editable=false] Boolean | Array optional

      If true, and userId is the logged-in user's id, the tool presents an interface for the logged-in user to edit their name and icon. This can also be an array containing one or more of 'icon', 'name'.

    • [short=false] Boolean optional

      If true, renders the short version of the display name.

    • [className] String optional

      Any css classes to add to the tool element

    • [reflectChanges=true] Boolean optional

      Whether the tool should update its contents on changes to user streams like firstName, lastName, username and icon. Set to false if you are showing many avatars in a list such as "Users/list" or "Streams/participating" tools. Otherwise it can result many database queries – one per avatar!

    • [reflectIconChanges=String(options.icon).isUrl()] Boolean optional

      Whether to automatically update the icon if the user's icon stream changes

    • [cacheBust=null] Number optional

      Number of milliseconds to use for combating the re-use of cached images when they are first loaded.

    • [templates] Object optional
      • [icon] Object optional
      • [icon.dir='{{Users}}/views'] String optional
      • [icon.name='Users/avatar/icon'] String optional
      • [icon.fields] Object optional
      • [contents] Object optional
      • [contents.dir='{{Users}}/views'] String optional
      • [contents.name='Users/avatar/contents'] String optional
      • [contents.fields] Object optional
      • [contents.fields.tag="span"] String optional
    • [inplaces] Object optional

      Additional fields to pass to the child Streams/inplace tools, if any

    • [onRefresh] Q.Event optional

      An event that occurs when the avatar is refreshed

    • [onUpdate] Q.Event optional

      An event that occurs when the icon is updated via this tool

    • [onImagepicker] Q.Event optional

      An event that occurs when the imagepicker is activated

    • [onMissing] Q.Event optional

      An event that occurs if the avatar info turns out to be missing

  • [options.templates.icon.fields.alt="user String

    icon"]

Item Index

Methods

Methods

refresh

(
  • [unlessContent=false]
)

Refresh the avatar's display

Parameters:

  • [unlessContent=false] Boolean optional

    only used by constructor to pass true

refresh

()

Refresh the avatar's display