DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Erico has posted 5 posts at DZone. View Full User Profile

Taglib Para Grails Que Apoia Na Exibição De Textos Muito Longos

09.15.2009
| 2236 views |
  • submit to reddit
        uso: 
1. <g:shortDescription size="10">Erico Vicente Marineli</g:shortDescription> 
   saída : Erico Vice...

2. <g:shortDescription size="10">${fieldValue(bean:cargoInstance, field:'descricao')}</g:shortDescription></g:link>


def shortDescription = { attrs, body ->
   def str = body.call()
   def size = Integer.valueOf(attrs.size)
   
   out << str.getAt(0..(size < str.length() ? size : str.length()) ).trim() + (size < str.length() ? "..." : "")
}