Skip to content

Instantly share code, notes, and snippets.

@nicmarti
Created November 18, 2011 13:42
Show Gist options
  • Save nicmarti/1376491 to your computer and use it in GitHub Desktop.
Save nicmarti/1376491 to your computer and use it in GitHub Desktop.
Play 2.0 generate a list from A to Z and group by last name
@(contacts:List[(models.Contact)])
<html>
<head>
<title>Contact - Play! 2 Sample application</title>
</head>
<body>
Number of contacts in the database: @contacts.length<br/>
@for(letter<-("ABCDEFGHIJKLMNOPQRSTUVWXYZ#")) {
<div>
<span class="letter">@letter</span>
@contacts.filter(_.name.toUpperCase.charAt(0)==letter).map{ contact=>
<strong>@contact.name</strong> @contact.firstName
}
</div>
}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment