Changeset 254 for trunk/grails-app/controllers
- Timestamp:
- Dec 30, 2009, 4:33:42 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/AssignedGroupDetailedController.groovy
r248 r254 12 12 // the delete, save and update actions only accept POST requests 13 13 static allowedMethods = [delete:'POST', save:'POST', update:'POST'] 14 15 def list = {16 def result = assignedGroupService.list(params)17 if(!result.error) {18 return [ assignedGroupInstanceList: result.assignedGroupInstanceList,19 assignedGroupInstanceTotal: result.assignedGroupInstanceTotal ]20 }21 22 flash.message = g.message(code: result.error.code, args: result.error.args)23 redirect( controller: "appCore", action: "start" )24 }25 26 def show = {27 def result = assignedGroupService.show(params)28 29 if(!result.error)30 return [ assignedGroupInstance: result.assignedGroupInstance ]31 32 flash.message = g.message(code: result.error.code, args: result.error.args)33 34 if(params.task?.id)35 redirect(controller:"taskDetailed", action:"show", id: params.task.id)36 37 redirect(controller:"taskDetailed", action:"search")38 }39 14 40 15 def delete = { … … 60 35 def result = assignedGroupService.edit(params) 61 36 62 if(!result.error) 63 return [ assignedGroupInstance : result.assignedGroupInstance ] 37 if(!result.error) { 38 return [assignedGroupInstance: result.assignedGroupInstance, 39 personGroup: result.personGroup, 40 personsInGroup: result.personsInGroup] 41 } 64 42 65 43 flash.message = g.message(code: result.error.code, args: result.error.args) … … 74 52 if(!result.error) { 75 53 flash.message = g.message(code: "default.update.success", args: ["AssignedGroup", params.id]) 76 redirect( action:show, id: params.id)54 redirect(controller:"taskDetailed", action:"show", id: result.assignedGroupInstance.task.id) 77 55 return 78 56 } … … 84 62 } 85 63 86 render(view:'edit', model:[assignedGroupInstance: result.assignedGroupInstance.attach()]) 64 if(result.error.code == "personGroup.not.found") { 65 flash.message = g.message(code: result.error.code, args: result.error.args) 66 redirect(action:"edit", id: params.id) 67 return 68 } 69 70 render(view:'edit', model:[assignedGroupInstance: result.assignedGroupInstance.attach(), 71 personGroup: result.personGroup.attach(), 72 personsInGroup: result.personsInGroup]) 87 73 } 88 74 … … 90 76 def result = assignedGroupService.create(params) 91 77 92 if(!result.error) 93 return [assignedGroupInstance: result.assignedGroupInstance] 78 if(!result.error) { 79 return [assignedGroupInstance: result.assignedGroupInstance, 80 personGroup: result.personGroup, 81 personsInGroup: result.personsInGroup] 82 } 94 83 95 84 if(result.error.code == "assignedGroup.task.not.found") { … … 112 101 } 113 102 114 render(view:'edit', model:[assignedGroupInstance: result.assignedGroupInstance]) 103 if(result.error.code == "personGroup.not.found") { 104 flash.message = g.message(code: result.error.code, args: result.error.args) 105 redirect(action:"create", params:["task.id": params.task?.id]) 106 return 107 } 108 109 render(view:'create', model:[assignedGroupInstance: result.assignedGroupInstance, 110 personGroup: result.personGroup.attach(), 111 personsInGroup: result.personsInGroup]) 112 } 113 114 def personsInGroup = { 115 def result = assignedGroupService.personsInGroup(params) 116 117 if(!result.error) { 118 render ( template:"personsInGroup", 119 model: [personGroup: result.personGroup, personsInGroup: result.personsInGroup] ) 120 return 121 } 122 123 render { 124 div(id:"personsInGroup", g.message(code: result.error.code, args: result.error.args) ) 125 } 126 115 127 } 116 128
Note: See TracChangeset
for help on using the changeset viewer.