- Timestamp:
- Feb 7, 2011, 3:43:55 PM (14 years ago)
- Location:
- branches/features/taskProcedureRework/grails-app
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/features/taskProcedureRework/grails-app/domain/TaskProcedure.groovy
r772 r793 14 14 15 15 List maintenanceActions = new ArrayList() 16 List documentReferences = new ArrayList() 16 17 17 static hasMany = [tasks: Task, maintenanceActions: MaintenanceAction] 18 static hasMany = [tasks: Task, 19 maintenanceActions: MaintenanceAction, 20 documentReferences: DocumentReference] 18 21 19 22 def getMaintenanceActionLazyList() { 20 23 return LazyList.decorate(maintenanceActions, FactoryUtils.instantiateFactory(MaintenanceAction.class)) 24 } 25 26 def getDocumentReferenceLazyList() { 27 return LazyList.decorate(documentReferences, FactoryUtils.instantiateFactory(DocumentReference.class)) 21 28 } 22 29 … … 25 32 static mapping = { 26 33 maintenanceActions cascade:"all-delete-orphan" 34 documentReferences cascade:"all-delete-orphan" 27 35 } 28 36 -
branches/features/taskProcedureRework/grails-app/services/TaskProcedureService.groovy
r775 r793 49 49 result.taskProcedureInstance.maintenanceActions.removeAll(nullMaintenanceActions) 50 50 } 51 def nullDocumentReferences = result.taskProcedureInstance.documentReferences.findAll {!it} 52 if (nullDocumentReferences) { 53 result.taskProcedureInstance.documentReferences.removeAll(nullDocumentReferences) 54 } 51 55 52 56 // Save for restoration if validation fails. 53 57 def savedMaintenanceActions = new ArrayList(result.taskProcedureInstance.maintenanceActions) 58 def savedDocumentReferences = new ArrayList(result.taskProcedureInstance.documentReferences) 54 59 55 60 // Remove toBeDeleted before validation. 56 def toBeDeleted = result.taskProcedureInstance.maintenanceActions.findAll {it.toBeDeleted} 57 if (toBeDeleted) { 58 result.taskProcedureInstance.maintenanceActions.removeAll(toBeDeleted) 61 def ma_toBeDeleted = result.taskProcedureInstance.maintenanceActions.findAll {it.toBeDeleted} 62 if (ma_toBeDeleted) { 63 result.taskProcedureInstance.maintenanceActions.removeAll(ma_toBeDeleted) 64 } 65 def docRef_toBeDeleted = result.taskProcedureInstance.documentReferences.findAll {it.toBeDeleted} 66 if (docRef_toBeDeleted) { 67 result.taskProcedureInstance.documentReferences.removeAll(docRef_toBeDeleted) 59 68 } 60 69 … … 64 73 // The toBeDeleted items are hidden in the view. 65 74 result.taskProcedureInstance.maintenanceActions = savedMaintenanceActions 66 // Populate maintenanceAction errors for display. 75 result.taskProcedureInstance.documentReferences = savedDocumentReferences 76 // Populate collection errors for display. 67 77 result.taskProcedureInstance.maintenanceActions.each { it.validate() } 78 result.taskProcedureInstance.documentReferences.each { it.validate() } 68 79 return fail(code:"default.update.failure") 69 80 } … … 108 119 result.taskProcedureInstance.maintenanceActions.removeAll(nullMaintenanceActions) 109 120 } 121 def nullDocumentReferences = result.taskProcedureInstance.documentReferences.findAll {!it} 122 if (nullDocumentReferences) { 123 result.taskProcedureInstance.documentReferences.removeAll(nullDocumentReferences) 124 } 110 125 111 126 // Also sets: taskInstance.taskProcedure = taskProcedureInstance … … 113 128 114 129 if(result.taskProcedureInstance.hasErrors() || !result.taskProcedureInstance.save()) { 115 // Populate maintenanceAction errors for display.130 // Populate collection errors for display. 116 131 result.taskProcedureInstance.maintenanceActions.each { it.validate() } 132 result.taskProcedureInstance.documentReferences.each { it.validate() } 117 133 return fail(code:"default.create.failure") 118 134 } -
branches/features/taskProcedureRework/grails-app/views/taskDetailed/show.gsp
r788 r793 561 561 </div> 562 562 563 <br /> 564 565 <g:if test="${taskProcedureInstance.documentReferences}"> 566 <div class="list"> 567 <table> 568 <thead> 569 <tr> 570 <th>Document Reference</th> 571 <th>Location</th> 572 </tr> 573 </thead> 574 <tbody> 575 <g:each in="${taskProcedureInstance.documentReferences}" status="i" var="docRef"> 576 <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 577 578 <td valign="top" class="name"> 579 ${fieldValue(bean:docRef, field:'name')} 580 </td> 581 582 <td valign="top" style="text-align:left;" class="value"> 583 ${fieldValue(bean:docRef, field:'location')} 584 </td> 585 586 </tr> 587 </g:each> 588 589 </tbody> 590 </table> 591 </div> 592 </g:if> 593 594 <br /> 595 563 596 <div class="list"> 564 597 <table> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_taskProcedure.gsp
r780 r793 62 62 63 63 <br /> 64 <g:render template="documentReferences" model="['taskProcedureInstance': taskProcedureInstance]" /> 65 66 <br /> 64 67 <g:render template="maintenanceActions" model="['taskProcedureInstance': taskProcedureInstance, 65 68 'assemblies': assemblies]" /> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp
r778 r793 33 33 </div> 34 34 <table style="display:none;"> 35 <g:render template="documentReference" model="['docRef': null, 36 'i': '_clone']" /> 37 </table> 38 <table style="display:none;"> 35 39 <g:render template="maintenanceAction" model="['tp': null, 36 40 'ma': null, -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/edit.gsp
r778 r793 36 36 </div> 37 37 <table style="display:none;"> 38 <g:render template="documentReference" model="['docRef': null, 39 'i': '_clone']" /> 40 </table> 41 <table style="display:none;"> 38 42 <g:render template="maintenanceAction" model="['tp': null, 39 43 'ma': null,
Note: See TracChangeset
for help on using the changeset viewer.