Changeset 96
- Timestamp:
- Mar 31, 2009, 5:43:09 AM (16 years ago)
- Location:
- trunk/src/grails-app
- Files:
-
- 14 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/grails-app/conf/BootStrap.groovy
r93 r96 215 215 comment:"Has been noted as problematic, try recallibrating") 216 216 BootStrapSaveAndTest(taskInstance) 217 taskInstance.addToAssignedPersons(Person.get(1))218 taskInstance.addToAssignedPersons(Person.get(2))219 217 220 218 subTaskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"), … … 226 224 comment:"Some help required") 227 225 BootStrapSaveAndTest(subTaskInstance) 228 subTaskInstance.addToAssignedPersons(Person.get(1))229 226 230 227 //Add task 2 as a subTask of task 1. … … 240 237 comment:"Nothing else has worked.") 241 238 BootStrapSaveAndTest(subTaskInstance) 242 subTaskInstance.addToAssignedPersons(Person.get(1))243 239 244 240 //Add task 3 as a subTask of task 1. … … 314 310 taskModificationTypeInstance = new TaskModificationType(name:"AssignedToModified").save() 315 311 taskModificationTypeInstance = new TaskModificationType(name:"NameModified").save() 316 312 313 //AssignedPerson 314 def assignedPersonInstance 315 316 assignedPersonInstance = new AssignedPerson(person: Person.get(4), 317 task: Task.get(1), 318 estimatedHour: 1, 319 estimatedMinute: 20) 320 BootStrapSaveAndTest(assignedPersonInstance) 321 322 assignedPersonInstance = new AssignedPerson(person: Person.get(5), 323 task: Task.get(1), 324 estimatedHour: 3, 325 estimatedMinute: 30) 326 BootStrapSaveAndTest(assignedPersonInstance) 327 328 329 //Finally did it all work. 317 330 if(BootStrapDemoDataSuccessful) { 318 331 println "BootStrapping demo data...successful." -
trunk/src/grails-app/controllers/TaskController.groovy
r85 r96 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 @Secured(['ROLE_AppAdmin']) 4 class TaskController extends BaseController { 3 class TaskController extends BaseAppAdminController { 5 4 6 5 def index = { redirect(action:list,params:params) } … … 10 9 11 10 def list = { 12 if(!params.max) params.max = 1013 [ taskInstanceList: Task.list( params ) ]11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ taskInstanceList: Task.list( params ), taskInstanceTotal: Task.count() ] 14 13 } 14 15 15 def show = { 16 16 def taskInstance = Task.get( params.id ) … … 22 22 else { return [ taskInstance : taskInstance ] } 23 23 } 24 24 25 25 def delete = { 26 26 def taskInstance = Task.get( params.id ) 27 27 if(taskInstance) { 28 taskInstance.delete() 29 flash.message = "Task ${params.id} deleted" 30 redirect(action:list) 28 try { 29 taskInstance.delete() 30 flash.message = "Task ${params.id} deleted" 31 redirect(action:list) 32 } 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = "Task ${params.id} could not be deleted" 35 redirect(action:show,id:params.id) 36 } 31 37 } 32 38 else { … … 51 57 def taskInstance = Task.get( params.id ) 52 58 if(taskInstance) { 59 if(params.version) { 60 def version = params.version.toLong() 61 if(taskInstance.version > version) { 62 63 taskInstance.errors.rejectValue("version", "task.optimistic.locking.failure", "Another user has updated this Task while you were editing.") 64 render(view:'edit',model:[taskInstance:taskInstance]) 65 return 66 } 67 } 53 68 taskInstance.properties = params 54 69 if(!taskInstance.hasErrors() && taskInstance.save()) { … … 82 97 } 83 98 } 84 85 99 } -
trunk/src/grails-app/controllers/TaskDetailedController.groovy
r85 r96 9 9 10 10 def list = { 11 if(!params.max) params.max = 1012 [ taskInstanceList: Task.list( params ) ]11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ taskInstanceList: Task.list( params ), taskInstanceTotal: Task.count() ] 13 13 } 14 14 … … 26 26 def taskInstance = Task.get( params.id ) 27 27 if(taskInstance) { 28 taskInstance.delete() 29 flash.message = "Task ${params.id} deleted" 30 redirect(action:list) 28 try { 29 taskInstance.delete() 30 flash.message = "Task ${params.id} deleted" 31 redirect(action:list) 32 } 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = "Task ${params.id} could not be deleted" 35 redirect(action:show,id:params.id) 36 } 31 37 } 32 38 else { … … 57 63 def taskInstance = Task.get( params.id ) 58 64 if(taskInstance) { 65 if(params.version) { 66 def version = params.version.toLong() 67 if(taskInstance.version > version) { 68 69 taskInstance.errors.rejectValue("version", "task.optimistic.locking.failure", "Another user has updated this Task while you were editing.") 70 render(view:'edit',model:[taskInstance:taskInstance]) 71 return 72 } 73 } 59 74 taskInstance.properties = params 60 75 if(!taskInstance.hasErrors() && taskInstance.save()) { -
trunk/src/grails-app/domain/Task.groovy
r93 r96 16 16 static hasMany = [entries: Entry, 17 17 taskModifications: TaskModification, 18 assignedPersons: Person,18 assignedPersons: AssignedPerson, 19 19 subTasks: Task] 20 20 -
trunk/src/grails-app/views/task/create.gsp
r70 r96 41 41 </td> 42 42 <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'description','errors')}"> 43 <input type="text" maxlength=" 50" id="description" name="description" value="${fieldValue(bean:taskInstance,field:'description')}"/>43 <input type="text" maxlength="75" id="description" name="description" value="${fieldValue(bean:taskInstance,field:'description')}"/> 44 44 </td> 45 45 </tr> -
trunk/src/grails-app/views/task/edit.gsp
r93 r96 25 25 <g:form method="post" > 26 26 <input type="hidden" name="id" value="${taskInstance?.id}" /> 27 <input type="hidden" name="version" value="${taskInstance?.version}" /> 27 28 <div class="dialog"> 28 29 <table> … … 43 44 </td> 44 45 <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'description','errors')}"> 45 <input type="text" maxlength=" 50" id="description" name="description" value="${fieldValue(bean:taskInstance,field:'description')}"/>46 <input type="text" maxlength="75" id="description" name="description" value="${fieldValue(bean:taskInstance,field:'description')}"/> 46 47 </td> 47 48 </tr> … … 100 101 <ul> 101 102 <g:each var="a" in="${taskInstance?.assignedPersons?}"> 102 <li><g:link controller=" person" action="show" id="${a.id}">${a?.encodeAsHTML()}</g:link></li>103 </g:each> 104 </ul> 105 <g:link controller=" person" params="['task.id':taskInstance?.id]" action="create">AddPerson</g:link>103 <li><g:link controller="assignedPerson" action="show" id="${a.id}">${a?.encodeAsHTML()}</g:link></li> 104 </g:each> 105 </ul> 106 <g:link controller="assignedPerson" params="['task.id':taskInstance?.id]" action="create">Add AssignedPerson</g:link> 106 107 107 108 </td> … … 153 154 <tr class="prop"> 154 155 <td valign="top" class="name"> 155 <label for="taskModifications">Modifications:</label>156 </td>157 <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'taskModifications','errors')}">158 159 <ul>160 <g:each var="m" in="${taskInstance?.taskModifications?}">161 <li><g:link controller="taskModification" action="show" id="${m.id}">${m?.encodeAsHTML()}</g:link></li>162 </g:each>163 </ul>164 <g:link controller="taskModification" params="['task.id':taskInstance?.id]" action="create">Add Modification</g:link>165 166 </td>167 </tr>168 169 <tr class="prop">170 <td valign="top" class="name">171 156 <label for="subTasks">Sub Tasks:</label> 172 157 </td> … … 198 183 <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'taskGroup','errors')}"> 199 184 <g:select optionKey="id" from="${TaskGroup.list()}" name="taskGroup.id" value="${taskInstance?.taskGroup?.id}" ></g:select> 185 </td> 186 </tr> 187 188 <tr class="prop"> 189 <td valign="top" class="name"> 190 <label for="taskModifications">Task Modifications:</label> 191 </td> 192 <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'taskModifications','errors')}"> 193 194 <ul> 195 <g:each var="t" in="${taskInstance?.taskModifications?}"> 196 <li><g:link controller="taskModification" action="show" id="${t.id}">${t?.encodeAsHTML()}</g:link></li> 197 </g:each> 198 </ul> 199 <g:link controller="taskModification" params="['task.id':taskInstance?.id]" action="create">Add TaskModification</g:link> 200 200 201 </td> 201 202 </tr> -
trunk/src/grails-app/views/task/list.gsp
r70 r96 58 58 </div> 59 59 <div class="paginateButtons"> 60 <g:paginate total="${ Task.count()}" />60 <g:paginate total="${taskInstanceTotal}" /> 61 61 </div> 62 62 </div> -
trunk/src/grails-app/views/task/show.gsp
r93 r96 82 82 <td valign="top" class="name">Assigned Persons:</td> 83 83 84 <td valign="top" class="value">${fieldValue(bean:taskInstance, field:'assignedPersons')}</td> 84 <td valign="top" style="text-align:left;" class="value"> 85 <ul> 86 <g:each var="a" in="${taskInstance.assignedPersons}"> 87 <li><g:link controller="assignedPerson" action="show" id="${a.id}">${a?.encodeAsHTML()}</g:link></li> 88 </g:each> 89 </ul> 90 </td> 85 91 86 92 </tr> … … 121 127 122 128 <tr class="prop"> 123 <td valign="top" class="name">Modifications:</td>124 125 <td valign="top" style="text-align:left;" class="value">126 <ul>127 <g:each var="m" in="${taskInstance.taskModifications}">128 <li><g:link controller="taskModification" action="show" id="${m.id}">${m?.encodeAsHTML()}</g:link></li>129 </g:each>130 </ul>131 </td>132 133 </tr>134 135 <tr class="prop">136 129 <td valign="top" class="name">Sub Tasks:</td> 137 130 … … 161 154 162 155 <tr class="prop"> 156 <td valign="top" class="name">Task Modifications:</td> 157 158 <td valign="top" style="text-align:left;" class="value"> 159 <ul> 160 <g:each var="t" in="${taskInstance.taskModifications}"> 161 <li><g:link controller="taskModification" action="show" id="${t.id}">${t?.encodeAsHTML()}</g:link></li> 162 </g:each> 163 </ul> 164 </td> 165 166 </tr> 167 168 <tr class="prop"> 163 169 <td valign="top" class="name">Task Type:</td> 164 170 -
trunk/src/grails-app/views/taskDetailed/edit.gsp
r91 r96 151 151 <g:select optionKey="id" from="${TaskType.list()}" name="taskType.id" value="${taskInstance?.taskType?.id}" ></g:select> 152 152 </td> 153 </tr> 154 155 <tr class="prop"> 156 <td valign="top" class="name"> 157 <label for="assignedPersons">Assigned Persons:</label> 158 </td> 159 <td valign="top" class="value ${hasErrors(bean:taskInstance,field:'assignedPersons','errors')}"> 160 161 <ul> 162 <g:each var="a" in="${taskInstance?.assignedPersons?}"> 163 <li><g:link controller="assignedPersonDetailed" action="show" id="${a.id}">${a?.encodeAsHTML()}</g:link></li> 164 </g:each> 165 </ul> 166 <g:link controller="assignedPersonDetailed" params="['task.id':taskInstance?.id]" action="create">Add AssignedPerson</g:link> 167 168 </td> 153 169 </tr> 170 171 154 172 155 173 </tbody> -
trunk/src/grails-app/views/taskDetailed/show.gsp
r91 r96 78 78 79 79 <tr class="prop"> 80 <td valign="top" class="name">Assigned Persons:</td>81 82 <td valign="top" style="text-align:left;" class="value">83 <ul>84 <g:each var="s" in="${taskInstance.assignedPersons}">85 <li>${s?.firstName} ${s?.lastName}</li>86 </g:each>87 </ul>88 </td>89 90 </tr>91 92 <tr class="prop">93 80 <td valign="top" class="name">Is Active:</td> 94 81 … … 142 129 143 130 <td valign="top" class="value">${taskInstance?.taskType?.encodeAsHTML()}</td> 131 132 </tr> 133 134 <tr class="prop"> 135 <td valign="top" class="name">Assigned Persons:</td> 136 137 <td valign="top" style="text-align:left;" class="value"> 138 <ul> 139 <g:each var="a" in="${taskInstance.assignedPersons}"> 140 <li><g:link controller="assignedPersonDetailed" action="edit" id="${a.id}">${a?.encodeAsHTML()}</g:link></li> 141 </g:each> 142 </ul> 143 </td> 144 144 145 145 </tr>
Note: See TracChangeset
for help on using the changeset viewer.