Changeset 276 for trunk/grails-app/controllers
- Timestamp:
- Jan 20, 2010, 8:12:16 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/grails-app/controllers/AssetSubItemDetailedController.groovy ¶
r274 r276 64 64 assetSubItemInstance.properties = params 65 65 66 if(!assetSubItemInstance.asset && !assetSubItemInstance.parentItem) {67 flash.message = "Either an asset or parentItem is required."68 render(view:'edit',model:[assetSubItemInstance:assetSubItemInstance])69 return70 }71 72 if(assetSubItemInstance.asset && assetSubItemInstance.parentItem) {73 flash.message = "Both an asset and parentItem may not be specified at the same time."74 render(view:'edit',model:[parentItem:parentItem])75 return76 }66 // if(!assetSubItemInstance.asset && !assetSubItemInstance.parentItem) { 67 // flash.message = "Either an asset or parentItem is required." 68 // render(view:'edit',model:[assetSubItemInstance:assetSubItemInstance]) 69 // return 70 // } 71 // 72 // if(assetSubItemInstance.asset && assetSubItemInstance.parentItem) { 73 // flash.message = "Both an asset and parentItem may not be specified at the same time." 74 // render(view:'edit',model:[parentItem:parentItem]) 75 // return 76 // } 77 77 78 78 if(!assetSubItemInstance.hasErrors() && assetSubItemInstance.save(flush: true)) { 79 79 flash.message = "AssetSubItem ${params.id} updated" 80 80 81 if(assetSubItemInstance.asset )82 redirect(controller: "assetDetailed", action:"show", id: assetSubItemInstance.asset .id)81 if(assetSubItemInstance.assets) 82 redirect(controller: "assetDetailed", action:"show", id: assetSubItemInstance.assets.toArray()[0].id) 83 83 else { 84 84 //Get the top parentItem. … … 93 93 } 94 94 95 if(parentItem .asset)96 redirect(controller: "assetDetailed", action:"show", id: parentItem.asset .id)95 if(parentItem?.assets) 96 redirect(controller: "assetDetailed", action:"show", id: parentItem.assets.toArray()[0].id) 97 97 else 98 98 redirect(action:"show", id: assetSubItemInstance.id) // End stop if all else fails. … … 118 118 def assetSubItemInstance = new AssetSubItem(params) 119 119 120 if(!assetSubItemInstance.asset && !assetSubItemInstance.parentItem) {121 flash.message = "Either an asset or parentItem is required."122 render(view:'create',model:[assetSubItemInstance:assetSubItemInstance])123 return124 }125 126 if(assetSubItemInstance.asset && assetSubItemInstance.parentItem) {127 flash.message = "Both an asset and parentItem may not be specified at the same time."128 render(view:'create',model:[assetSubItemInstance:assetSubItemInstance])129 return130 }120 // if(!assetSubItemInstance.asset && !assetSubItemInstance.parentItem) { 121 // flash.message = "Either an asset or parentItem is required." 122 // render(view:'create',model:[assetSubItemInstance:assetSubItemInstance]) 123 // return 124 // } 125 // 126 // if(assetSubItemInstance.asset && assetSubItemInstance.parentItem) { 127 // flash.message = "Both an asset and parentItem may not be specified at the same time." 128 // render(view:'create',model:[assetSubItemInstance:assetSubItemInstance]) 129 // return 130 // } 131 131 132 132 if(!assetSubItemInstance.hasErrors() && assetSubItemInstance.save(flush: true)) { 133 133 flash.message = "AssetSubItem ${assetSubItemInstance.id} created" 134 134 135 if(assetSubItemInstance.asset )136 redirect(controller: "assetDetailed", action:"show", id: assetSubItemInstance.asset .id)135 if(assetSubItemInstance.assets) 136 redirect(controller: "assetDetailed", action:"show", id: assetSubItemInstance.assets.toArray()[0].id) 137 137 else { 138 138 //Get the top parentItem. … … 147 147 } 148 148 149 if(parentItem .asset)150 redirect(controller: "assetDetailed", action:"show", id: parentItem.asset .id)149 if(parentItem?.assets) 150 redirect(controller: "assetDetailed", action:"show", id: parentItem.assets.toArray()[0].id) 151 151 else 152 152 redirect(action:"show", id: assetSubItemInstance.id) // End stop if all else fails.
Note: See TracChangeset
for help on using the changeset viewer.