groovy - Creating a Custom Conditional TagLib in Grails -


I am trying to create a conditional taglib in grails to determine whether or not to display the user's avatar (I have found the ifLoggedIn tag based on the code here :)

My taglib looks like this:

  def ifProfileAvatar = {attrs, body - & gt; Deaf Username = session.user.login def currentUser = Account.findByLogin (Username) if (current user profile and current user.profile.oververment) {outside & lt; & Lt; "Avatar found" body {}}}   

And in my GSP I use tags like this:

    

When I navigate to GSP, "Avatar found" is being displayed correctly (directly from the tag Lib), but "Profile found!" is not.

Is there any reason that the tag is not showing body in body {} GSP?

Any idea where this could be wrong?

Thank you!

body , I think it should be:

  def ifProfileAvatar = {attrs, body - & gt; Deaf Username = session.user.login def currentUser = Account.findByLogin (Username) if (current user profile and current user.profile.oververment) {outside & lt; & Lt; "Avatar got it out" & lt; & Lt; Body () // use () not {}}}   

refer to more example

Comments