in velocity, you could use this:
#if($helper.page.isFavourite($action.remoteUser)) <a href="$req.contextPath/labels/removefavourite.action?entityId=$helper.page.id&#url_xsrfToken()" alt-title="$action.getText('favourite.add.page')" title="$action.getText('favourite.remove.page')" class="fav-toggle active aui-button" > remove </a> #else <a href="$req.contextPath/labels/addfavourite.action?entityId=$helper.page.id&#url_xsrfToken()" alt-title="$action.getText('favourite.remove.page')" title="$action.getText('favourite.add.page')" class="fav-toggle aui-button " > add </a> #end
similar in java ;-)
Thanks for the code snippet, Oliver, it helped me greatly. However, I had to make some minor adjustments:
#if($content.isFavourite($action.remoteUser)) <a href="$req.contextPath/labels/removefavourite.action?entityId=$content.getIdAsString()&#url_xsrfToken()" alt-title="$action.getText('favourite.add.page')" title="$action.getText('favourite.remove.page')" class="fav-toggle aui-button"> remove </a> #else <a href="$req.contextPath/labels/addfavourite.action?entityId=$content.getIdAsString()&#url_xsrfToken()" alt-title="$action.getText('favourite.remove.page')" title="$action.getText('favourite.add.page')" class="fav-toggle aui-button"> add </a> #end
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Discover the teamwork and precision behind success on and off the track. See how this high-performing team makes the impossible possible. Be one of the first 100 customers to register for a chance to win 2 tickets to an Atlassian Williams 2026 race.
Register now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.