Announcing Guide Templating API v2

Return to top
Have more questions? Submit a request

6 Comments

  • Aleksey Kislov

    Hello,

    I just found out that user tags that were provided in JS object by 'HelpCenter.user.tags' field are no longer available. That fields returns 'undefined' but used to return array of user tags before V2. Several of our clients are dependent on this functionality, and now it's just stopped working — without a single deprecation note. How is it possible?

    UPD: `tags` field just appeared for me again — for no visible reason. Due to lack of documentation I assume these methods are not blindly to rely on. Is there any other way to access user object in Help Center via JS?  

    0
  • Gorka Cardona-Lauridsen
    Zendesk Product Manager

    Hi Aleksey, we have not changed the behavior of providing an array of user tags. If the user is not signed in it will not return the array though. That behavior has not either changed.

    Post again if the problem reappears for signed in users.

    0
  • Brad Marshall

    So, I just attempted to upgrade to v2 and got the following error.

    file: templates/community_topic_list_page.hbs
    line: 51
    message: `pagination` resolves to a helper

    This is what my code does:

    {{#if pagination}}
    <divclass="mdl-card__actions mdl-card--border">
    {{pagination}}
    </div>
    {{/if}}
     
    Am I no longer allowed to use `pagination` in an `if` function? I have about 17 instances where I perform a similar `if` analysis to determine if a block of code should be displayed. It makes it much cleaner and usable.
    0
  • Greg - Community Manager
    Zendesk Developer Support

    Hi Brad...I haven't seen this explicitly documented anywhere, however everything that I've read internally indicates that if statements won't work in this situation. I've reached out to our product team internally to get some clarification around this and as soon as I hear back, I'll drop you a line. Thanks for your patience!

    0
  • Brad Marshall

    Thank you, Greg - Community Manager. If they have alternatives to accomplish this, then I would be happy to adjust my code for the upgrade.

    0
  • Augusto Silva
    Zendesk team member

    Hi Brad Marshall

    Thanks for trying out Templating API v2 :)

    We mention it in the release notes  but it could indeed offer some more details.

    Advanced helpers, because they output HTML, should not be used as data in conditional expressions. Also, helpers can receive arguments which is not a compatible syntax with conditional expressions. Unfortunately, an issue in the validation engine was allowing this behavior. This was addressed in V2 as it is a breaking change.

    For your specific case, you could try to use the :empty css pseudo-class to hide the wrapping div in the case there are no elements inside.

    <div class="test">{{pagination}}</div>

    .test {
    border-style: dotted;
    }

    .test:empty {
    display: none;
    }

    Hope this helps.

    0

Please sign in to leave a comment.

Powered by Zendesk