Skip to main content

Gift template

Description

The gift template renders the static shell of the Gift Widget: column 1 ("To Who") with the user search and recipient display, and column 3 ("Why") with the reason textarea and send button. It contains an empty placeholder element (mambo-ctrl-gift-what) into which the dynamic "For What" column is injected once rewards data has loaded from the server. The dynamic column is rendered by its own sub-template — see the Gift What template page.

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-whatPlaceholder element into which the Gift What sub-template is injected when rewards data loads. Must be present in the shell for column 2 to appearYes
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
titleThe widget title. Either the value of the title render option or the default from the language modelString
prizeOptional prize message displayed below the title. Set via the prize render option. Null when not configuredString | null

Note: data, user, withPoints, withGifts, and isLoading are not available in this template. They are passed to the Gift What sub-template instead — see Gift What template.

Implementation example

This example shows a gift shell template with user search in column 1, a placeholder for the dynamically injected "For What" column, and the reason textarea and send button in column 3. To customise the gifts and points UI in column 2, override the Mambo.Template.giftWhat template separately.

JavaScript

Customisation options

Consider these enhancements:

  • Adding autocomplete or typeahead behaviour for the user search field
  • Implementing client-side form validation for the search and reason fields
  • Adding confirmation steps before sending gifts
  • Supporting custom messages with rich text formatting in the reason textarea
  • Overriding the Gift What sub-template independently via Mambo.Template.giftWhat to customise how rewards and points are presented without touching the shell layout