Changeset 762 for branches/features/taskProcedureRework
- Timestamp:
- Jan 28, 2011, 10:04:40 PM (14 years ago)
- Location:
- branches/features/taskProcedureRework/grails-app
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/features/taskProcedureRework/grails-app/controllers/TaskProcedureDetailedController.groovy
r760 r762 99 99 taskProcedureInstance.properties = params 100 100 101 def toBeDeleted = taskProcedureInstance.maintenanceActions.findAll {it. _deleted}101 def toBeDeleted = taskProcedureInstance.maintenanceActions.findAll {it.deleted} 102 102 if(toBeDeleted) { 103 103 taskProcedureInstance.maintenanceActions.removeAll(toBeDeleted) … … 134 134 def save = { 135 135 def taskProcedureInstance = new TaskProcedure(params) 136 def taskInstance = Task.get(params. parentTask.id)136 def taskInstance = Task.get(params.linkedTask.id) 137 137 138 138 if(!taskProcedureInstance.hasErrors() && taskProcedureInstance.save(flush: true)) { -
branches/features/taskProcedureRework/grails-app/domain/MaintenanceAction.groovy
r760 r762 11 11 Integer procedureStepNumber 12 12 13 boolean deleted13 Boolean deleted 14 14 static transients = [ 'deleted' ] 15 15 -
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 ;1 import org.apache.commons.collections.list.LazyList 2 import org.apache.commons.collections.FactoryUtils 3 3 4 4 class TaskProcedure { 5 5 6 Task parentTask 6 Task linkedTask 7 8 def getDescription() { linkedTask.description } 9 def getAsset() { linkedTask.primaryAsset } 10 7 11 List maintenanceActions = new ArrayList() 12 8 13 static hasMany = [tasks: Task, maintenanceActions: MaintenanceAction] 14 15 def getMaintenanceActionLazyList() { 16 return LazyList.decorate(maintenanceActions, FactoryUtils.instantiateFactory(MaintenanceAction.class)) 17 } 9 18 10 19 static mappedBy = [tasks:"taskProcedure"] 11 20 12 21 static mapping = { 13 maintenanceActions cascade:"all ,delete-orphan"22 maintenanceActions cascade:"all-delete-orphan" 14 23 } 15 24 … … 22 31 "${this.id}" 23 32 } 24 25 def getExpandableMaintenanceActionList() {26 return LazyList.decorate(maintenanceActions, FactoryUtils.instantiateFactory(MaintenanceAction.class))27 }28 33 } -
branches/features/taskProcedureRework/grails-app/services/CreateDataService.groovy
r760 r762 1100 1100 1101 1101 taskInstance = Task.get(5) 1102 taskProcedureInstance = new TaskProcedure( parentTask: taskInstance)1102 taskProcedureInstance = new TaskProcedure(linkedTask: taskInstance) 1103 1103 saveAndTest(taskProcedureInstance) 1104 1104 taskProcedureInstance.addToTasks(taskInstance) 1105 1105 1106 1106 taskInstance = Task.get(7) 1107 taskProcedureInstance = new TaskProcedure( parentTask: taskInstance)1107 taskProcedureInstance = new TaskProcedure(linkedTask: taskInstance) 1108 1108 saveAndTest(taskProcedureInstance) 1109 1109 taskProcedureInstance.addToTasks(taskInstance) -
branches/features/taskProcedureRework/grails-app/views/taskDetailed/show.gsp
r760 r762 519 519 520 520 <tr class="prop"> 521 <td valign="top" class="name"> ParentTask:</td>521 <td valign="top" class="name">Linked Task:</td> 522 522 <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()} 525 525 </g:link> 526 526 </td> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceActions.gsp
r761 r762 6 6 var deleteIcon = "${resource(dir:'images/skin', file:'database_delete.png')}"; 7 7 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"; 9 9 templateHtml += "<span onClick='jQuery(\"#" + htmlId + "\").remove();'><img src='" + deleteIcon + "' /></span>\n"; 10 10 templateHtml += "</div>\n"; … … 15 15 16 16 <div id="childList"> 17 <g:each var="m " in="${taskProcedureInstance.maintenanceActions}" status="i">17 <g:each var="ma" in="${taskProcedureInstance.maintenanceActions}" status="i"> 18 18 <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> 23 25 </div> 24 26 </g:each> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp
r761 r762 23 23 24 24 <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}" /> 26 26 27 27 <div class="dialog"> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/edit.gsp
r758 r762 35 35 <tr class="prop"> 36 36 <td valign="top" class="name"> 37 <label for="taskInstance"> ParentTask:</label>37 <label for="taskInstance">Linked Task:</label> 38 38 </td> 39 39 <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()} 42 42 </g:link> 43 43 </td> … … 48 48 <label for="maintenanceActions">Maintenance Actions:</label> 49 49 </td> 50 50 51 <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]" /> 69 53 </td> 70 54 </tr> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/list.gsp
r758 r762 39 39 40 40 <g:sortableColumn property="id" title="Id" params="${filterParams}" /> 41 <th> TaskDescription</th>41 <th>Description</th> 42 42 <th>Asset</th> 43 43 … … 52 52 <td>${fieldValue(bean:taskProcedureInstance, field:'id')}</td> 53 53 54 <td>${taskProcedureInstance. parentTask.description.encodeAsHTML()}</td>54 <td>${taskProcedureInstance.description.encodeAsHTML()}</td> 55 55 56 <td>${taskProcedureInstance. parentTask.primaryAsset?.encodeAsHTML()}</td>56 <td>${taskProcedureInstance.asset?.encodeAsHTML()}</td> 57 57 58 58 <td> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/show.gsp
r760 r762 26 26 27 27 <tr class="prop"> 28 <td valign="top" class="name"> ParentTask:</td>28 <td valign="top" class="name">Linked Task:</td> 29 29 <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()} 32 32 </g:link> 33 33 </td> … … 40 40 <ul> 41 41 <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> 43 43 </g:each> 44 44 </ul>
Note: See TracChangeset
for help on using the changeset viewer.