Changeset 305


Ignore:
Timestamp:
Jan 29, 2010, 2:29:26 PM (15 years ago)
Author:
gav
Message:

Add a possibleAssetSubItems function to filter sub items when editing assets.

Location:
trunk/grails-app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/AssetDetailedController.groovy

    r302 r305  
    236236        }
    237237        else {
    238             return [ assetInstance : assetInstance ]
     238            return [ assetInstance : assetInstance, possibleAssetSubItems: assetService.possibleAssetSubItems() ]
    239239        }
    240240    }
     
    251251
    252252                    assetInstance.errors.rejectValue("version", "asset.optimistic.locking.failure", "Another user has updated this Asset while you were editing.")
    253                     render(view:'edit',model:[assetInstance:assetInstance])
     253                    render(view:'edit',model:[assetInstance:assetInstance, possibleAssetSubItems: assetService.possibleAssetSubItems()])
    254254                    return
    255255                }
     
    265265            }
    266266            else {
    267                 render(view:'edit',model:[assetInstance:assetInstance])
     267                render(view:'edit',model:[assetInstance:assetInstance, possibleAssetSubItems: assetService.possibleAssetSubItems()])
    268268            }
    269269        }
  • trunk/grails-app/services/AssetService.groovy

    r284 r305  
    22
    33    boolean transactional = false
     4
     5    /**
     6    * Determines and returns a possible list of asset sub items.
     7    * @returns A list of the possible assetSubItems.
     8    */
     9    def possibleAssetSubItems() {
     10        def criteria = AssetSubItem.createCriteria()
     11        def possibleAssetSubItems = criteria.list() {
     12            isNull("parentItem")
     13        }
     14    }
    415
    516    def create(params) {
Note: See TracChangeset for help on using the changeset viewer.