Changeset 758 for branches/features/taskProcedureRework/grails-app
- Timestamp:
- Jan 26, 2011, 3:29:08 AM (14 years ago)
- Location:
- branches/features/taskProcedureRework/grails-app
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/features/taskProcedureRework/grails-app/controllers/TaskProcedureDetailedController.groovy
r403 r758 50 50 if(taskProcedureInstance) { 51 51 try { 52 taskProcedureInstance.tasks.each { 53 it.taskProcedure = null 54 } 52 55 taskProcedureInstance.delete(flush:true) 53 56 flash.message = "TaskProcedure ${params.id} deleted" … … 125 128 def save = { 126 129 def taskProcedureInstance = new TaskProcedure(params) 127 def taskInstance = Task.get(params. taskInstance.id)130 def taskInstance = Task.get(params.parentTask.id) 128 131 129 132 if(!taskProcedureInstance.hasErrors() && taskProcedureInstance.save(flush: true)) { 130 taskProcedureInstance.addToTasks(taskInstance) 133 taskProcedureInstance.addToTasks(taskInstance) // also sets: taskInstance.taskProcedure = taskProcedureInstance 131 134 flash.message = "TaskProcedure ${taskProcedureInstance.id} created." 132 135 redirect(action:show,id:taskProcedureInstance.id) -
branches/features/taskProcedureRework/grails-app/domain/TaskProcedure.groovy
r754 r758 1 1 class TaskProcedure { 2 2 3 Task parentTask 4 3 5 static hasMany = [tasks: Task, maintenanceActions: MaintenanceAction] 6 7 static mappedBy = [tasks:"taskProcedure"] 4 8 5 9 // static belongsTo = [] -
branches/features/taskProcedureRework/grails-app/services/CreateDataService.groovy
r751 r758 1097 1097 //TaskProcedure 1098 1098 def taskProcedureInstance 1099 1100 taskProcedureInstance = new TaskProcedure(name: "Daily check") 1099 def taskInstance 1100 1101 taskInstance = Task.get(5) 1102 taskProcedureInstance = new TaskProcedure(parentTask: taskInstance) 1101 1103 saveAndTest(taskProcedureInstance) 1102 taskProcedureInstance.addToTasks(Task.list()[0]) 1103 1104 taskProcedureInstance = new TaskProcedure(name: "100hr Service") 1104 taskProcedureInstance.addToTasks(taskInstance) 1105 1106 taskInstance = Task.get(7) 1107 taskProcedureInstance = new TaskProcedure(parentTask: taskInstance) 1105 1108 saveAndTest(taskProcedureInstance) 1106 taskProcedureInstance.addToTasks( Task.list()[6])1109 taskProcedureInstance.addToTasks(taskInstance) 1107 1110 } 1108 1111 -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp
r754 r758 22 22 </g:hasErrors> 23 23 <g:form action="save" method="post" > 24 <input type="hidden" name=" taskInstance.id" value="${taskInstance?.id}" />24 <input type="hidden" name="parentTask.id" value="${taskInstance.id}" /> 25 25 26 26 <div class="dialog"> … … 28 28 <tbody> 29 29 30 < g:if test="${taskInstance}">31 <t r class="prop">32 < td valign="top" class="name">33 <label for="taskInstance">Linking with Task:</label>34 </td>35 < td valign="top" name="taskInstance" class="value">36 ${taskInstance }37 </ td>38 </t r>39 </ g:if>30 <tr class="prop"> 31 <td valign="top" class="name"> 32 <label for="taskInstance">Parent Task:</label> 33 </td> 34 <td valign="top" name="taskInstance" class="value"> 35 <g:link controller="taskDetailed" action="show" id="${taskInstance.id}"> 36 ${taskInstance.encodeAsHTML()} 37 </g:link> 38 </td> 39 </tr> 40 40 41 41 </tbody> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/edit.gsp
r754 r758 35 35 <tr class="prop"> 36 36 <td valign="top" class="name"> 37 <label for="taskInstance">Parent Task:</label> 38 </td> 39 <td valign="top" name="taskInstance" class="value"> 40 <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.parentTask.id}"> 41 ${taskProcedureInstance.parentTask.encodeAsHTML()} 42 </g:link> 43 </td> 44 </tr> 45 46 <tr class="prop"> 47 <td valign="top" class="name"> 37 48 <label for="maintenanceActions">Maintenance Actions:</label> 38 49 </td> 39 50 <td valign="top" class="value ${hasErrors(bean:taskProcedureInstance,field:'maintenanceActions','errors')}"> 40 41 <ul> 42 <g:each var="m" in="${taskProcedureInstance?.maintenanceActions?}"> 43 <li><g:link controller="maintenanceActionDetailed" action="show" id="${m.id}">${m?.encodeAsHTML()}</g:link></li> 44 </g:each> 45 </ul> 46 <g:link controller="maintenanceActionDetailed" params="['taskProcedure.id':taskProcedureInstance?.id]" action="create">+Add MaintenanceAction</g:link> 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> 47 68 48 69 </td> 49 </tr> 50 51 <tr class="prop"> 52 <td valign="top" class="name"> 53 <label for="tasks">Tasks:</label> 54 </td> 55 <td valign="top" class="value ${hasErrors(bean:taskProcedureInstance,field:'tasks','errors')}"> 56 57 <ul> 58 <g:each var="t" in="${taskProcedureInstance?.tasks?}"> 59 <li><g:link controller="taskDetailed" action="show" id="${t.id}">${t?.encodeAsHTML()}</g:link></li> 60 </g:each> 61 </ul> 62 <g:link controller="taskDetailed" params="['taskProcedure.id':taskProcedureInstance?.id]" action="create">+Add Task</g:link> 70 </tr> 63 71 64 </td>65 </tr>66 67 72 </tbody> 68 73 </table> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/list.gsp
r754 r758 39 39 40 40 <g:sortableColumn property="id" title="Id" params="${filterParams}" /> 41 42 41 <th>Task Description</th> 42 <th>Asset</th> 43 43 44 44 <th></th> … … 52 52 <td>${fieldValue(bean:taskProcedureInstance, field:'id')}</td> 53 53 54 <td>${taskProcedureInstance.tasks.encodeAsHTML()}</td> 54 <td>${taskProcedureInstance.parentTask.description.encodeAsHTML()}</td> 55 56 <td>${taskProcedureInstance.parentTask.primaryAsset?.encodeAsHTML()}</td> 55 57 56 58 <td> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/show.gsp
r754 r758 22 22 <tr class="prop"> 23 23 <td valign="top" class="name">Id:</td> 24 25 24 <td valign="top" class="value">${fieldValue(bean:taskProcedureInstance, field:'id')}</td> 26 27 25 </tr> 28 26 27 <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"> 32 <g:link controller="taskDetailed" action="show" id="${taskProcedureInstance.parentTask.id}"> 33 ${taskProcedureInstance.parentTask.encodeAsHTML()} 34 </g:link> 35 </td> 36 </tr> 37 29 38 <tr class="prop"> 30 39 <td valign="top" class="name">Maintenance Actions:</td> 31 40 32 41 <td valign="top" style="text-align:left;" class="value"> 33 42 <ul> … … 37 46 </ul> 38 47 </td> 39 48 40 49 </tr> 41 42 <tr class="prop"> 43 <td valign="top" class="name">Tasks:</td> 44 45 <td valign="top" style="text-align:left;" class="value"> 46 <ul> 47 <g:each var="t" in="${taskProcedureInstance.tasks}"> 48 <li><g:link controller="taskDetailed" action="show" id="${t.id}">${t?.encodeAsHTML()}</g:link></li> 49 </g:each> 50 </ul> 51 </td> 52 53 </tr> 54 50 55 51 </tbody> 56 52 </table>
Note: See TracChangeset
for help on using the changeset viewer.