Changeset 762 for branches/features


Ignore:
Timestamp:
Jan 28, 2011, 10:04:40 PM (14 years ago)
Author:
gav
Message:

Domain change on TaskProcedure and MaintenanceAction, continue task procedure rework.

Location:
branches/features/taskProcedureRework/grails-app
Files:
10 edited

Legend:

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

    r760 r762  
    9999            taskProcedureInstance.properties = params
    100100
    101             def toBeDeleted = taskProcedureInstance.maintenanceActions.findAll {it._deleted}
     101            def toBeDeleted = taskProcedureInstance.maintenanceActions.findAll {it.deleted}
    102102            if(toBeDeleted) {
    103103                taskProcedureInstance.maintenanceActions.removeAll(toBeDeleted)
     
    134134    def save = {
    135135        def taskProcedureInstance = new TaskProcedure(params)
    136         def taskInstance = Task.get(params.parentTask.id)
     136        def taskInstance = Task.get(params.linkedTask.id)
    137137
    138138        if(!taskProcedureInstance.hasErrors() && taskProcedureInstance.save(flush: true)) {
  • branches/features/taskProcedureRework/grails-app/domain/MaintenanceAction.groovy

    r760 r762  
    1111    Integer procedureStepNumber
    1212
    13     boolean deleted
     13    Boolean deleted
    1414    static transients = [ 'deleted' ]
    1515
  • branches/features/taskProcedureRework/grails-app/domain/TaskProcedure.groovy

    r760 r762  
    1 import org.apache.commons.collections.list.LazyList;
    2 import org.apache.commons.collections.FactoryUtils;
     1import org.apache.commons.collections.list.LazyList
     2import org.apache.commons.collections.FactoryUtils
    33
    44class TaskProcedure {
    55
    6     Task parentTask
     6    Task linkedTask
     7
     8    def getDescription() { linkedTask.description }
     9    def getAsset() { linkedTask.primaryAsset }
     10
    711    List maintenanceActions = new ArrayList()
     12
    813    static hasMany = [tasks: Task, maintenanceActions: MaintenanceAction]
     14
     15    def getMaintenanceActionLazyList() {
     16        return LazyList.decorate(maintenanceActions, FactoryUtils.instantiateFactory(MaintenanceAction.class))
     17    }
    918
    1019    static mappedBy = [tasks:"taskProcedure"]
    1120
    1221    static mapping = {
    13         maintenanceActions cascade:"all,delete-orphan"
     22        maintenanceActions cascade:"all-delete-orphan"
    1423    }
    1524
     
    2231        "${this.id}"
    2332    }
    24 
    25     def getExpandableMaintenanceActionList() {
    26         return LazyList.decorate(maintenanceActions, FactoryUtils.instantiateFactory(MaintenanceAction.class))
    27     }
    2833}
  • branches/features/taskProcedureRework/grails-app/services/CreateDataService.groovy

    r760 r762  
    11001100
    11011101        taskInstance = Task.get(5)
    1102         taskProcedureInstance = new TaskProcedure(parentTask: taskInstance)
     1102        taskProcedureInstance = new TaskProcedure(linkedTask: taskInstance)
    11031103        saveAndTest(taskProcedureInstance)
    11041104        taskProcedureInstance.addToTasks(taskInstance)
    11051105
    11061106        taskInstance = Task.get(7)
    1107         taskProcedureInstance = new TaskProcedure(parentTask: taskInstance)
     1107        taskProcedureInstance = new TaskProcedure(linkedTask: taskInstance)
    11081108        saveAndTest(taskProcedureInstance)
    11091109        taskProcedureInstance.addToTasks(taskInstance)
  • branches/features/taskProcedureRework/grails-app/views/taskDetailed/show.gsp

    r760 r762  
    519519
    520520                        <tr class="prop">
    521                             <td valign="top" class="name">Parent Task:</td>
     521                            <td valign="top" class="name">Linked Task:</td>
    522522                            <td valign="top" class="value">
    523                                 <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.parentTask.id}">
    524                                     ${taskProcedureInstance.parentTask.encodeAsHTML()}
     523                                <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.linkedTask.id}">
     524                                    ${taskProcedureInstance.linkedTask.encodeAsHTML()}
    525525                                </g:link>
    526526                            </td>
  • branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceActions.gsp

    r761 r762  
    66        var deleteIcon = "${resource(dir:'images/skin', file:'database_delete.png')}";
    77        var templateHtml = "<div id='" + htmlId + "' name='" + htmlId + "'>\n";
    8         templateHtml += "<input type='text' id='expandableMaintenanceActionList[" + childCount + "].description' name='expandableMaintenanceActionList[" + childCount + "].description' />\n";
     8        templateHtml += "<input type='text' id='maintenanceActionLazyList[" + childCount + "].description' name='maintenanceActionLazyList[" + childCount + "].description' />\n";
    99        templateHtml += "<span onClick='jQuery(\"#" + htmlId + "\").remove();'><img src='" + deleteIcon + "' /></span>\n";
    1010        templateHtml += "</div>\n";
     
    1515
    1616<div id="childList">
    17     <g:each var="m" in="${taskProcedureInstance.maintenanceActions}" status="i">
     17    <g:each var="ma" in="${taskProcedureInstance.maintenanceActions}" status="i">
    1818        <div id="maintenanceAction${i}">
    19             <g:hiddenField name='expandableMaintenanceActionList[${i}].id' value='${maintenanceAction.id}'/>
    20             <g:textField name='expandableMaintenanceActionList[${i}].description' value='${maintenanceAction.description}'/>
    21             <input type="hidden" name='expandableMaintenanceActionList[${i}].deleted' id='expandableMaintenanceActionList[${i}].deleted' value='false'/>
    22             <span onClick="jQuery('#expandableMaintenanceActionList\\[${i}\\]\\.deleted').val('true'); jQuery('#maintenanceAction${i}').hide()"><img src="${resource(dir:'images/skin', file:'database_delete.png')}" /></span>
     19            <g:hiddenField name='maintenanceActionLazyList[${i}].id' value='${ma.id}'/>
     20            <g:textField name='maintenanceActionLazyList[${i}].description' value='${ma.description}'/>
     21            <input type="hidden" name='maintenanceActionLazyList[${i}].deleted' id='maintenanceActionLazyList[${i}].deleted' value='false'/>
     22            <span onClick="jQuery('#maintenanceActionLazyList\\[${i}\\]\\.deleted').val('true'); jQuery('#maintenanceAction${i}').hide()">
     23                <img src="${resource(dir:'images/skin', file:'database_delete.png')}" />
     24            </span>
    2325        </div>
    2426    </g:each>
  • branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp

    r761 r762  
    2323
    2424            <g:form action="save" method="post" >
    25             <input type="hidden" name="parentTask.id" value="${taskInstance.id}" />
     25            <input type="hidden" name="linkedTask.id" value="${taskInstance.id}" />
    2626
    2727                <div class="dialog">
  • branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/edit.gsp

    r758 r762  
    3535                            <tr class="prop">
    3636                                <td valign="top" class="name">
    37                                     <label for="taskInstance">Parent Task:</label>
     37                                    <label for="taskInstance">Linked Task:</label>
    3838                                </td>
    3939                                <td valign="top" name="taskInstance" class="value">
    40                                     <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.parentTask.id}">
    41                                         ${taskProcedureInstance.parentTask.encodeAsHTML()}
     40                                    <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.linkedTask.id}">
     41                                        ${taskProcedureInstance.linkedTask.encodeAsHTML()}
    4242                                    </g:link>
    4343                                </td>
     
    4848                                    <label for="maintenanceActions">Maintenance Actions:</label>
    4949                                </td>
     50
    5051                                <td valign="top" class="value ${hasErrors(bean:taskProcedureInstance,field:'maintenanceActions','errors')}">
    51 
    52                                     <ul>
    53                                         <g:each var="m" in="${taskProcedureInstance?.maintenanceActions?}">
    54                                             <li>
    55                                                 <g:link controller="maintenanceActionDetailed"
    56                                                                 action="show"
    57                                                                 id="${m.id}">
    58                                                     ${m?.encodeAsHTML()}
    59                                                 </g:link>
    60                                             </li>
    61                                         </g:each>
    62                                     </ul>
    63                                     <g:link controller="maintenanceActionDetailed"
    64                                                 params="['taskProcedure.id':taskProcedureInstance?.id]"
    65                                                 action="create">
    66                                         +Add MaintenanceAction
    67                                     </g:link>
    68 
     52                                    <g:render template="maintenanceActions" model="['taskProcedureInstance': taskProcedureInstance]" />
    6953                                </td>
    7054                            </tr>
  • branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/list.gsp

    r758 r762  
    3939
    4040                                <g:sortableColumn property="id" title="Id"  params="${filterParams}" />
    41                                 <th>Task Description</th>
     41                                <th>Description</th>
    4242                                <th>Asset</th>
    4343
     
    5252                                <td>${fieldValue(bean:taskProcedureInstance, field:'id')}</td>
    5353
    54                                 <td>${taskProcedureInstance.parentTask.description.encodeAsHTML()}</td>
     54                                <td>${taskProcedureInstance.description.encodeAsHTML()}</td>
    5555
    56                                 <td>${taskProcedureInstance.parentTask.primaryAsset?.encodeAsHTML()}</td>
     56                                <td>${taskProcedureInstance.asset?.encodeAsHTML()}</td>
    5757
    5858                                <td>
  • branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/show.gsp

    r760 r762  
    2626
    2727                        <tr class="prop">
    28                             <td valign="top" class="name">Parent Task:</td>
     28                            <td valign="top" class="name">Linked Task:</td>
    2929                            <td valign="top" class="value">
    30                                 <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.parentTask.id}">
    31                                     ${taskProcedureInstance.parentTask.encodeAsHTML()}
     30                                <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.linkedTask.id}">
     31                                    ${taskProcedureInstance.linkedTask.encodeAsHTML()}
    3232                                </g:link>
    3333                            </td>
     
    4040                                <ul>
    4141                                <g:each var="m" in="${taskProcedureInstance.maintenanceActions}">
    42                                     <li><g:link controller="maintenanceActionDetailed" action="show" id="${m.id}">${m?.encodeAsHTML()}</g:link></li>
     42                                    <li>${m?.encodeAsHTML()}</li>
    4343                                </g:each>
    4444                                </ul>
Note: See TracChangeset for help on using the changeset viewer.