Changeset 760 for branches/features


Ignore:
Timestamp:
Jan 26, 2011, 5:35:35 AM (14 years ago)
Author:
gav
Message:

Domain change, frist draft of creating taskProcedure dynamic form.

Location:
branches/features/taskProcedureRework/grails-app
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/features/taskProcedureRework/grails-app/controllers/TaskProcedureDetailedController.groovy

    r758 r760  
    9898            }
    9999            taskProcedureInstance.properties = params
     100
     101            def toBeDeleted = taskProcedureInstance.maintenanceActions.findAll {it._deleted}
     102            if(toBeDeleted) {
     103                taskProcedureInstance.maintenanceActions.removeAll(toBeDeleted)
     104            }
     105
    100106            if(!taskProcedureInstance.hasErrors() && taskProcedureInstance.save(flush: true)) {
    101107                flash.message = "TaskProcedure ${params.id} updated"
  • branches/features/taskProcedureRework/grails-app/domain/MaintenanceAction.groovy

    r756 r760  
    1010    String reasoning = ""
    1111    Integer procedureStepNumber
     12
     13    boolean deleted
     14    static transients = [ 'deleted' ]
    1215
    1316//     static hasMany = []
  • branches/features/taskProcedureRework/grails-app/domain/TaskProcedure.groovy

    r758 r760  
     1import org.apache.commons.collections.list.LazyList;
     2import org.apache.commons.collections.FactoryUtils;
     3
    14class TaskProcedure {
    25
    36    Task parentTask
    4 
     7    List maintenanceActions = new ArrayList()
    58    static hasMany = [tasks: Task, maintenanceActions: MaintenanceAction]
    69
    710    static mappedBy = [tasks:"taskProcedure"]
     11
     12    static mapping = {
     13        maintenanceActions cascade:"all,delete-orphan"
     14    }
    815
    916//     static belongsTo = []
     
    1522        "${this.id}"
    1623    }
     24
     25    def getExpandableMaintenanceActionList() {
     26        return LazyList.decorate(maintenanceActions, FactoryUtils.instantiateFactory(MaintenanceAction.class))
     27    }
    1728}
  • branches/features/taskProcedureRework/grails-app/services/CreateDataService.groovy

    r758 r760  
    140140        createDemoAssignedPersons()
    141141        createDemoTaskProcedure()
    142         createDemoMaintenanceActions()
     142        //createDemoMaintenanceActions()
    143143        createDemoTaskRecurringSchedules()
    144144
  • branches/features/taskProcedureRework/grails-app/views/taskDetailed/show.gsp

    r755 r760  
    518518                                        </tr>
    519519
     520                        <tr class="prop">
     521                            <td valign="top" class="name">Parent Task:</td>
     522                            <td valign="top" class="value">
     523                                <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.parentTask.id}">
     524                                    ${taskProcedureInstance.parentTask.encodeAsHTML()}
     525                                </g:link>
     526                            </td>
     527                        </tr>
     528
    520529                                    </tbody>
    521530                                </table>
  • branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp

    r758 r760  
    66        <meta name="layout" content="main" />
    77        <title>Create TaskProcedure</title>
     8        <g:javascript library="jquery" plugin="jquery"/>
    89        <nav:resources override="true"/>
    910    </head>
     
    2122            </div>
    2223            </g:hasErrors>
     24
    2325            <g:form action="save" method="post" >
    2426            <input type="hidden" name="parentTask.id" value="${taskInstance.id}" />
     
    3941                            </tr>
    4042
     43                            <tr class="prop">
     44                                <td valign="top" class="name">
     45                                    <label for="maintenanceActions">Maintenance Actions:</label>
     46                                </td>
     47                                <td valign="top" class="value ${hasErrors(bean:taskProcedureInstance,field:'maintenanceActions','errors')}">
     48                                    <g:render template="maintenanceActions" model="['taskProcedureInstance': taskProcedureInstance]" />
     49                                </td>
     50                            </tr>
     51
    4152                        </tbody>
    4253                    </table>
  • branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/show.gsp

    r758 r760  
    2626
    2727                        <tr class="prop">
    28                             <td valign="top" class="name">
    29                                 <label for="taskInstance">Parent Task:</label>
    30                             </td>
    31                             <td valign="top" name="taskInstance" class="value">
     28                            <td valign="top" class="name">Parent Task:</td>
     29                            <td valign="top" class="value">
    3230                                <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.parentTask.id}">
    3331                                    ${taskProcedureInstance.parentTask.encodeAsHTML()}
Note: See TracChangeset for help on using the changeset viewer.