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.

Location:
trunk/grails-app/controllers
Files:
1 edited
6 copied

Legend:

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

    r122 r124  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class AssetController extends BaseAppAdminController {
     3class AssetDetailedController extends BaseController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/AssetExtendedAttributeDetailedController.groovy

    r122 r124  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class AssetExtendedAttributeController extends BaseAppAdminController {
     3class AssetExtendedAttributeDetailedController extends BaseController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • 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 {
  • trunk/grails-app/controllers/PlannedMaintenanceDetailedController.groovy

    r122 r124  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class PlannedMaintenanceController extends BaseAppAdminController {
     3class PlannedMaintenanceDetailedController extends BaseController {
    44   
    55    def index = { redirect(action:list,params:params) }
     
    1414
    1515    def show = {
     16// Use this to return a list of the maintenanceActions
     17//     def list = {
     18//         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
     19//         [ maintenanceActionInstanceList: MaintenanceAction.list( params ), maintenanceActionInstanceTotal: MaintenanceAction.count() ]
     20//     }
    1621        def plannedMaintenanceInstance = PlannedMaintenance.get( params.id )
    1722
  • trunk/grails-app/controllers/RecurringScheduleDetailedController.groovy

    r122 r124  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class RecurringScheduleController extends BaseAppAdminController {
     3class RecurringScheduleDetailedController extends BaseController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/SystemSectionDetailedController.groovy

    r122 r124  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class SystemSectionController extends BaseAppAdminController {
     3class SystemSectionDetailedController extends BaseController {
    44   
    55    def index = { redirect(action:list,params:params) }
  • trunk/grails-app/controllers/TaskDetailedController.groovy

    r106 r124  
    88    static allowedMethods = [delete:'POST', save:'POST', update:'POST']
    99
     10//     def list = {
     11//         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
     12//         def taskInstanceActives = Task.findAllByIsActive( true ).list( params )
     13// //         def taskInstanceList = taskInstanceActives.list( params )
     14//         return [ taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceActives.count() ]
     15//     }
     16
    1017    def list = {
    1118        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    12         def taskInstanceList = Task.findAllByIsActive( true )
    13         return [ taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceList.count() ]
     19        [ taskInstanceList: Task.list( params ), taskInstanceTotal: Task.count() ]
    1420    }
    1521
Note: See TracChangeset for help on using the changeset viewer.