close

Filter

loading table of contents...

Frontend Developer Manual / Version 2110

Table Of Contents

6.5.6 Elastic Social (es)

The Elastic Social FreeMarker API provides utility functions to enrich components with personal data. It uses the namespace lc for template calls. For more information see Section 6.3, “Elastic Social” in Blueprint Developer Manual .

es.complaining

Adds user specific data to components and function calls about users which there are complaints. It uses the namespace es for template calls.

Parameter Required Description
value Returns the complain value if true.
id The HTML id prefix for this component.
collection The name of collection.
itemId The name of itemId.
navigationId The name of navigationId.
customClass The name of customClass. Defaults to empty.

Table 6.58. Parameters of complaining


<@es.complaining id=userDetails.id
                 collection="users"
                 value=es.hasComplaintForCurrentUser(userDetails.id, "users")
                 itemId=itemId
                 navigationId=navigationId/>

Example 6.47. Enrich user specific data to component


es.getElasticSocialConfiguration(page)

Gets the Elastic Social configuration of a page. In general this is the root page of a site. Please check the CMS Javadoc for all available properties of ElasticSocialConfiguration.

Parameter Required Description
page The page to get the configuration for.

Table 6.59. Parameter of getElasticSocialConfiguration


<#assign elasticSocialConfiguration=es.getElasticSocialConfiguration(cmpage)/>
<#if elasticSocialConfiguration.isFeedbackEnabled()!false>
...
</#if>

Example 6.48. Checks if Elastic Social is enabled


es.getLogin()

Checks page setting for Elastic Social Webflow login form.

<@cm.include self=es.getLogin()!cm.UNDEFINED view="asButtonGroup"/>
es.isAnonymousUser()

Checks if the current user of the web page is a logged-in user or it is an anonymous user. Returns to true if the current user is not logged in.

<#if es.isAnonymousUser()>...</#if>
es.isAnonymous(communityUser)

Checks if the user choose not to publish its user name, profile image, and other personal information with its contributions. Returns to true if the user wants to remain anonymous.

Parameter Required Description
communityUser The user to be checked.

Table 6.60. Parameter of isAnonymous


<#if es.isAnonymous(self.author)>...</#if>
es.getCurrentTenant()

Returns the tenant of the current Thread. Throws Tenant Exception when no tenant has been set.

<#assign tenant=es.getCurrentTenant()/>
<#assign myUrl=cm.getLink('/signin/example_' + tenant)/>
<form action="${myUrl!""}" method="post">
  ...
</form>

Example 6.49. Sets the form action


es.hasUserWrittenReview(target)

Returns the written review of the user for a given bean.

Parameter Required Description
target The given bean.

Table 6.61. Parameter of hasUserWrittenReview


es.getReviewView(review)

Returns the preview or live rendering depending on the state of the current user.

Parameter Required Description
review Attributing a target with text, title and rating from an author.

Table 6.62. Parameter of getReviewView


<#assign reviewView=es.getReviewView(self)/>
<#if ["default", "undecided", "rejected"]?seq_contains(reviewView)>
  ...
</#if>

Example 6.50. Specified value rendering


es.hasUserRated(target)

Returns the rating score for the given community user and for a given bean.

Parameter Required Description
target The given bean.

Table 6.63. Parameter of hasUserRated


es.getCommentView(comment)

Returns the preview or live rendering depending on the state of the current user.

Parameter Required Description
comment Attributing a target with text from an author.

Table 6.64. Parameter of getCommentView


<#assign commentView=es.getCommentView(self)/>
<#if ["default", "undecided", "rejected"]?seq_contains(commentView)>
  ...
</#if>

Example 6.51. Specified value rendering


es.getMaxRating()

Returns 5.

es.getReviewMaxRating()

Returns 5.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.