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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.