Badge

Documentation → Badge

Overview

The badge component is a comprehensive call to action for the actions within the Userplane platform. We highly recommend using this component when allowing users to instigate conversations with each other from a users profile page. This component is aware of the state of the end user its pointed at and will show the appropriate status icon based on their current status. Further this component will also ensure that an IM is not launched with yourself as well as preventing the launch of an IM in other user states in which an IM would not properly be established ( for example if the user had not ever previously connected to the IM system ).
Property Description Required
userid The primary identifier of the user you wish to generate a badge for. yes
displayName Provide a display name to override the locale labels on the badge. This will cause the badge to display the name value provided. optional
containerId Provide the id property for a DOM element which you want to render the badge into. If not provided the badge will simply render inline where you call it. optional

Examples

To embed to badge widget simply add the following anywhere on the page you wish to see the badge.

<script type="text/javascript">
	up.render( "badge", {userid:"INSERT_USER_ID",displayName:"DISPLAY_NAME_OF_USER"} );
</script>

Locale Property Overrides

See Override Locale Settings
Property Value Default ( en-US )
statusChatLabel Label used when a user is set to ‘chat’ or ‘free to chat’ as their status. Chat
statusAvailableLabel Label used when a user is set to ‘available’. Available
statusAwayLabel Label used when a user is set to ‘away’. Away
statusDndLabel Label used when a user is set to ‘do not distrub’. Do not disturb
statusExtendedAwayLabel Label used when a user is set to ‘extended away’. Extended Away
statusOfflineLabel Label used when a user is offline. Offline
statusDisabledLabel Label used when a user either invalid or not provisioned within the system. Unavailable

Sample

This sample is of a locale override being added to your up.init call inside the settings object.
// this object would be added to your up.init call
settings: { locale: {
		statusChatLabel: "Chat",
		statusAvailableLabel: "Available",
		statusAwayLabel: "Away",
		statusDndLabel: "Do not disturb",
		statusExtendedAwayLabel:"Extended Away",
		statusOfflineLabel: "Offline",
		statusDisabledLabel: "Unavailable"
	}
}