Changeset 658 for trunk/grails-app
- Timestamp:
- Sep 24, 2010, 3:46:02 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/AssetSubItemDetailedController.groovy
r615 r658 177 177 if(!assetSubItemInstance.hasErrors() && assetSubItemInstance.save(flush: true)) { 178 178 flash.message = "Sub Item '${assetSubItemInstance.name}' updated" 179 180 if(assetSubItemInstance.assets) 181 redirect(controller: "assetDetailed", action:"show", id: assetSubItemInstance.assets.toArray()[0].id) 182 else { 183 //Get the top parentItem. 184 def parentItem = assetSubItemInstance.parentItem 185 def i = 0 186 while(parentItem?.parentItem) { 187 parentItem = parentItem.parentItem 188 // Protect against infinite recurrsion. 189 i++ 190 if(i > 100) 191 break 192 } 193 194 if(parentItem?.assets) 195 redirect(controller: "assetDetailed", action:"show", id: parentItem.assets.toArray()[0].id) 196 else 197 redirect(action:"show", id: assetSubItemInstance.id) // End stop if all else fails. 198 } 179 redirect(action:"show", id: assetSubItemInstance.id) 199 180 } 200 181 else { … … 206 187 redirect(action: "search") 207 188 } 208 } 189 } // update 209 190 210 191 def create = {
Note: See TracChangeset
for help on using the changeset viewer.