Skip to main content

Gift template

Description

The gift template is used by the Gift Widget.

Control classes

ClassDescriptionRequired
mambo-ctrl-giftContainer for the gift widget. When the popup option is true, this element is wrapped with an outer div for popup displayNo
mambo-ctrl-gift-searchInput element for user search. Triggers search from the second character typedNo
mambo-ctrl-gift-resultsContainer for search results. Hidden when user clicks outside this elementNo
mambo-ctrl-gift-selectWrapper for each search result item. When clicked, selects the user and populates the search fieldNo
mambo-ctrl-gift-picElement where the selected user's picture is displayed (if available)No
mambo-ctrl-gift-nameElement where the selected user's name is displayedNo
mambo-ctrl-gift-sel-whatToggles the mambo-ctrl-gift-flip element between front and back. Front needs class mambo-ctrl-show-gifts, back needs class mambo-ctrl-show-ptsNo
mambo-ctrl-gift-flipWrapper for the front and back card elementsNo
mambo-ctrl-show-giftsWrapper for elements shown on the front of the cardNo
mambo-ctrl-show-ptsWrapper for elements shown on the back of the cardNo
mambo-ctrl-gift-giftsSelect element with gift reward indices. On change, selects the reward and populates mambo-ctrl-gift-badgeNo
mambo-ctrl-gift-badgeElement where the selected gift reward's badge is displayedNo
mambo-ctrl-gift-ptsSelect element with point type IDs. Used to calculate remaining balance based on quantityNo
mambo-ctrl-gift-qntyInput for the number of points to giveNo
mambo-ctrl-gift-balanceDisplays the giver's remaining balance after giving. Updates as quantity changesNo
mambo-ctrl-gift-whyInput for the reason for giving the giftNo
mambo-ctrl-gift-sendButton to submit the gift informationNo
mambo-ctrl-errorElement for displaying server error messagesNo
mambo-ctrl-successElement for displaying thank you message after successful giftingNo

Template data

VariableDescriptionType
dataObject containing rewards sorted by type (achievements, levels, gifts, missions)Object
userCurrent user data objectObject
isLoadingFlag indicating whether rewards are still loadingBoolean

Implementation example

This example shows a gift template with user search, gift selection, and point gifting:

JavaScript

Customisation options

Consider these enhancements:

  • Adding autocomplete for user search
  • Creating visual previews for gift rewards
  • Implementing form validation for required fields
  • Adding confirmation steps before sending gifts
  • Supporting custom messages with rich text formatting