Last updated: 2020-11-16

Source: https://support.freshservice.com/support/solutions/articles/50000003068-custom-helpers

renderFromApi

Block helper. Makes an API call and on complete, whether success or failure, it executes the given block of the code. The parameters are accepted as same as the jQuery ajax paramters except the functions. Please refer jQuery ajax call here

Params

  • url {String \| Number}
  • Method {String}
  • Example:

    {{#renderFromApi url="/support/v2/solutions/articles/popular" method="GET"}}<br>    <section id="solutions-banner"><br>      <h2>Trending Topics</h2><br>      {{#this}}<br>        <a href="{{#if external\_url}}{{external\_url}}{{else}}/support/solutions/articles/{{id}}{{/if}}" class="card solution-card"><br>           <div class="elem-inline-mid"><br>             <h3>{{title}}</h3><br>             <p>{{description}}</p><br></div><br>         </a><br>      {{/this}}<br>    </section><br>{{/renderFromApi}}
    avatar

    Accepts params as normal image tag, one more extra param - name. Check for the profile picture for the user in the given url. If unavailable, then will render the first letter of the given name with the provided random image.

    Example:

    {{avatar name=user\_info.full\_name url=user\_info.profile\_pic class="user-profile-pic"}}
    Pagination

    The pagination helper is a block helper. The params needed for the pagination helpers are  -

    \- list

    \- id

    \- class (optional)

    \- perPage (optional) : determines the number of items shown in a page

    \- page (optional) : current page no

    \- params (optional)

    \- paginationContainer (the nav container id where the pagination links should be rendered)