Ignore:
Timestamp:
Apr 26, 2010, 4:53:36 PM (11 years ago)
Author:
roberth
Message:

Updated the fields of person to contain title, gender, prefix and mobile phone. Also updated the views so that the pagination buttons appear beneath the 'add new' button.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/PersonController.groovy

    r361 r382  
    44
    55    static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
     6    def possibleGenders = [ 'Male', 'Female' ]
    67
    78    def index = {
     
    1718        def personInstance = new Person()
    1819        personInstance.properties = params
    19         return [personInstance: personInstance]
     20        return [personInstance: personInstance, possibleGenders:possibleGenders]
    2021    }
    2122
     
    2324        def personInstance = new Person(params)
    2425        if (personInstance.save(flush: true)) {
    25             flash.message = "${message(code: 'default.created.message', args: [message(code: 'person.label', default: 'Person'), ( personInstance.firstName ? personInstance.firstName : "" ) + " " + ( personInstance.midInitials ? personInstance.midInitials : "" ) + " " + ( personInstance.lastName ? personInstance.lastName : "" )])}"
     26            flash.message = "${message(code: 'default.created.message', args: [message(code: 'person.label', default: 'Person'), ( personInstance.firstName ? personInstance.firstName : "" ) + " " + ( personInstance.prefix ? personInstance.prefix : "" ) + " " + ( personInstance.lastName ? personInstance.lastName : "" )])}"
    2627            redirect(action: "show", id: personInstance.id)
    2728        }
     
    4950        }
    5051        else {
    51             return [personInstance: personInstance]
     52            return [personInstance: personInstance,possibleGenders:possibleGenders]
    5253        }
    5354    }
     
    6768            personInstance.properties = params
    6869            if (!personInstance.hasErrors() && personInstance.save(flush: true)) {
    69                 flash.message = "${message(code: 'default.updated.message', args: [message(code: 'person.label', default: 'Person'), ( personInstance.firstName ? personInstance.firstName : "" ) + " " + ( personInstance.midInitials ? personInstance.midInitials : "" ) + " " + ( personInstance.lastName ? personInstance.lastName : "" )])}"
     70                flash.message = "${message(code: 'default.updated.message', args: [message(code: 'person.label', default: 'Person'), ( personInstance.firstName ? personInstance.firstName : "" ) + " " + ( personInstance.prefix ? personInstance.prefix : "" ) + " " + ( personInstance.lastName ? personInstance.lastName : "" )])}"
    7071                redirect(action: "show", id: personInstance.id)
    7172            }
     
    8485
    8586        if (personInstance) {
    86             def personName = ( personInstance.firstName ? personInstance.firstName : "" ) + " " + ( personInstance.midInitials ? personInstance.midInitials : "" ) + " " + ( personInstance.lastName ? personInstance.lastName : "" );
     87            def personName = ( personInstance.firstName ? personInstance.firstName : "" ) + " " + ( personInstance.prefix ? personInstance.prefix : "" ) + " " + ( personInstance.lastName ? personInstance.lastName : "" );
    8788            try {
    8889                personInstance.delete(flush: true)
Note: See TracChangeset for help on using the changeset viewer.