Adding the Dashboard Action

We can tell from looking at the code for our dashboard view that it will need the following data elements when it is rendered: event, tasks, volunteers, messages, and sponsorships. The first of these is a single TekEvent instance; the rest are collections of related objects.

Some of these collections need to be filtered or limited in some way. This will also be done in the controller action.

Let’s see how easy this can be. Open TekDays/grails-app/controllers/com/tekdays/DashboardController.groovy. The empty index action should already be there. Right after that, add the dashboard action:

bigger.2/TekDays/grails-app/controllers/com/tekdays/DashboardController.groovy
 
package​ com.tekdays
 
class​ DashboardController ...

Get Grails 2: A Quick-Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.