Changeset 186 for trunk/grails-app/controllers
- Timestamp:
- Nov 15, 2009, 1:50:18 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/EntryDetailedController.groovy
r185 r186 4 4 5 5 def personService 6 def taskService 6 7 7 8 def index = { redirect(action:list,params:params) } … … 20 21 if(!entryInstance) { 21 22 flash.message = "Entry not found with id ${params.id}" 22 redirect( action:list)23 redirect(controller: 'taskDetailed', action: 'search') 23 24 } 24 25 else { return [ entryInstance : entryInstance ] } … … 42 43 else { 43 44 flash.message = "Entry not found with id ${params.id}" 44 redirect( action:list)45 redirect(controller: "taskDetailed", action:"search") 45 46 } 46 47 } … … 50 51 if(!entryInstance) { 51 52 flash.message = "Entry not found with id ${params.id}" 52 redirect( action:list)53 redirect(controller: "taskDetailed", action:"search") 53 54 } 54 55 else { … … 86 87 else { 87 88 flash.message = "Entry not found with id ${params.id}" 88 redirect( action:edit,id:params.id)89 redirect(controller: "taskDetailed", action:"search") 89 90 } 90 91 } … … 98 99 } 99 100 catch(Exception e) { 100 flash.message = "Please select a task, then 'Add Entry' "101 redirect(controller:"taskDetailed", action:" list")101 flash.message = "Please select a task, then 'Add Entry'." 102 redirect(controller:"taskDetailed", action:"search") 102 103 } 103 104 } 104 105 105 106 def save = { 106 def entryInstance = newEntry(params)107 def result = taskService.createEntry(params) 107 108 108 entryInstance.enteredBy = personService.currentUser() 109 if(!entryInstance.hasErrors() && entryInstance.save(flush: true)) { 110 flash.message = "Entry ${entryInstance.id} created" 111 redirect(controller:"taskDetailed", action:"show", id: params.task.id) 109 if(!result.error) { 110 flash.message = "Entry created." 111 redirect(controller: "taskDetailed", action: "show", id: result.taskId) 112 112 } 113 113 else { 114 render(view:'create',model:[entryInstance:entryInstance]) 114 if(result.entryInstance) { 115 render(view:'create',model:[entryInstance: result.entryInstance]) 116 } 117 else { 118 flash.message = "Could not create entry." 119 redirect(controller: "taskDetailed", action:"search") 120 } 121 115 122 } 116 123 } 124 117 125 }
Note: See TracChangeset
for help on using the changeset viewer.