Ignore:
Timestamp:
May 4, 2009, 1:59:11 PM (16 years ago)
Author:
gav
Message:

Detail controller and views for Asset, AssetExtendedAttribute?, PlannedMaintenance?, MaintenanceAction?, RecurringSchedule?, SystemSection?.
Some minor work on Task controller and views.
Change PlannedMaintenance? relationship, adjust ERD, Bootstrap and Domain classes to suite.

File:
1 copied

Legend:

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

    r122 r124  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class MaintenanceActionController extends BaseAppAdminController {
     3class MaintenanceActionDetailedController extends BaseController {
    44   
    55    def index = { redirect(action:list,params:params) }
     
    8282
    8383    def create = {
    84         def maintenanceActionInstance = new MaintenanceAction()
    85         maintenanceActionInstance.properties = params
    86         return ['maintenanceActionInstance':maintenanceActionInstance]
     84        try {
     85            def plannedMaintenanceInstance = PlannedMaintenance.get(params.plannedMaintenanceInstance.id)
     86            def maintenanceActionInstance = new MaintenanceAction()
     87            maintenanceActionInstance.plannedMaintenance = plannedMaintenanceInstance
     88            return ['maintenanceActionInstance':maintenanceActionInstance]
     89        }
     90        catch(Exception e) {
     91            flash.message = "Please select a PlannedMaintenance, then 'Add action'"
     92            redirect(controller:"plannedMaintenanceDetailed", action:"list")
     93        }
    8794    }
    8895
     
    9198        if(!maintenanceActionInstance.hasErrors() && maintenanceActionInstance.save()) {
    9299            flash.message = "MaintenanceAction ${maintenanceActionInstance.id} created"
    93             redirect(action:show,id:maintenanceActionInstance.id)
     100            redirect(controller:"plannedMaintenanceDetailed", action:"show", id: params.plannedMaintenance.id)
    94101        }
    95102        else {
Note: See TracChangeset for help on using the changeset viewer.