I am trying to create a conditional taglib in grails to determine if the user should show the Avatar (I based the code on ifLoggedIn tags found here: http://www.grails.org/AuthTagLib )
My taglib is as follows:
def ifProfileAvatar = {attrs, body ->
def username = session.user.login
def currentUser = Account.findByLogin(username)
if (currentUser.profile && currentUser.profile.avatar) {
out << "avatar found"
body{}
}
}
And in my GSP, I use the tag as follows:
<g:ifProfileAvatar>
<br/>profile found!<br/>
</g:ifProfileAvatar>
When I go to GSP, "avatar found" displays correctly (directly from taglib), but "profile found!" no.
Is there a reason body{}taglib doesn't show body in GSP?
Any ideas where this might go wrong?
Thank!
source
share