General 3rd party add-on implementation

When using third-party add-ons either provided by Confluence or other vendors, there are sometimes a few more steps to implement, in order to make it work.

Info

The following list will grow over time - if there's any third-party you want to integrate, please get in touch with us. We'll be happy to extend the information on this page.

Since the implementations of Scroll Viewport vary a lot, I'll try to point to the various places where to adjust the code or add something. Usually, you want to apply the code to the page.vm file. If you use dedicated files for another contexts, you can add it there too or use a shared template to include in each of these pages.

Adaptavist Ratings macro

Solution: The add-on relies on session data only created on the specific Confluence page. We can't reproduce or recreate that session with client-side cookies alone. Which is why we need to send an AJAX request to a Confluence page, that contains a rate macro. This way, the required session data is created and rating works on Viewport. This solution is based on jQuery.

Note

The Confluence page has to be publicly viewable (so no redirection for that space enabled). If you need to redirect users to the viewport, you can create a second space with the rate macro and use that url to load the session.

Finding a fix on your own

If the add-on is not listed in the above list yet, you can fix it on your own.

Most often, it is not that hard to amend the missing functionality. Sometimes, the macros rely on some meta data, that is usually shipped with Confluence but not included in Viewport (since it is custom HTML).

Missing resources

most themes are based off the webhelp theme. If you started from scratch, you want to include the Atlassian resources to render some macros and default components used by these macros.

$page.resources.css
$page.resources.js
$page.resources.meta

Missing metadata

Finding what is missing requires to see the error logged in the console of the developer tool panel. (CMD+ALT+I or F12)

Most of the code gets minified, which is why we have to expand it (Chrome dev tools comes with a handy button to beautify the code with the { } button

Then we look where, in this case, g is defined:

AJS.Meta.get("remote-user") concludes, that the script is looking for the meta data.

If we look at the source code of a Confluence page with a team calendar macro loaded, we can see what is in place for the meta data:

Now we can just add that code to the viewport theme. However, the script expects a user here, possibly to define which calendar items to show. So we need to fetch the username of the currently logged in user. You can look into our documentation about placeholders to find out how to fill in the gaps.

<meta name="ajs-remote-user" content="$user.username">

That's it - now the calendar items are loading.

Generally, you can use these meta data tags, and almost all macros will work: