AddBookmark - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.7
Category
Reference Guide

This result component requires a user to be logged, otherwise it does not display anything (see CKS widgets). It adds on each search result a form that allows a result from a search page to be bookmarked. (Also see AddBookmark Widget)

Parameter Name

Type

Card

Default

Description

urlBuilder

String/Function

Mandatory

N/A

Name of an existing function or function that can be called to compute the result URL. See details below.

outsideClickTogglePanel

Boolean

Optional

false

Indicates if the click has to be monitored to change the component state. See tip below.

When the user uses the button to bookmark a result, a form is displayed, initialized with the result title, and the result abstract as a comment. But when the user submits the form to create the bookmark it does not want to bookmark a result in the search page, but the page where this result can be read.

The way to access this page is unknown from AFS Widgets since it depends of the integration made. So, the bookmarked URL has to be computed using the urlBuilder property. This property can receive a string containing the name of an existing function, or directly receive a function (if the configuration is done using JavaScript), as shown below:

var AFSWidgetAddBookmarkComponent = {
urlBuilder: function(jsonResult) {
return '/product?uri=' + encodeURIComponent(jsonResult.uri);
}
};

The function will receive the associated result from the AFS feed as a JSON object. It can be used to compute a URL to the product page, for example, where this item can be consulted.

At integration time, the component can be styled as a pop-up. The click on the main button toggles the presence of a CSS class on the component top-level container, allowing to update the panel visibility.
If styled as a pop-up, the outsideClickTogglePanel option can be useful to change the component state when a click occurs outside of the component panel, by removing the previously mentioned CSS class.