Changeset 164
- Timestamp:
- Oct 23, 2009, 9:49:35 AM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/Department.groovy
r162 r164 6 6 boolean isActive = true 7 7 8 static hasMany = [systemSections: SystemSection ]8 static hasMany = [systemSections: SystemSection, persons: Person] 9 9 10 10 // static belongsTo = [] 11 11 12 // static constraints = { 13 // 14 // } 12 static constraints = { 13 name() 14 description() 15 costCode() 16 isActive() 17 } 15 18 16 19 String toString() { -
trunk/grails-app/domain/Person.groovy
r154 r164 8 8 9 9 static belongsTo = [Authority, PersonGroup] 10 11 Department department 10 12 11 13 String loginName … … 38 40 employeeID(blank: true, nullable:true) 39 41 description() 42 department(nullable:true) 40 43 email() 41 44 emailShow() -
trunk/grails-app/services/CreateDataService.groovy
r162 r164 113 113 //TypeOfPersonGroup 114 114 def personGroupTypeInstance 115 personGroupTypeInstance = new PersonGroupType(name:" Department")115 personGroupTypeInstance = new PersonGroupType(name:"Team") 116 116 saveAndTest(personGroupTypeInstance) 117 117 personGroupTypeInstance = new PersonGroupType(name:"Contractor") … … 122 122 //PersonGroup 123 123 def personGroupInstance 124 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType. findByName("Department"),124 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.get(1), 125 125 name:"Electrical") 126 126 saveAndTest(personGroupInstance) 127 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType. findByName("Department"),127 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.get(1), 128 128 name:"Mechanical") 129 129 saveAndTest(personGroupInstance) 130 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType. findByName("Department"),130 personGroupInstance = new PersonGroup(personGroupType:PersonGroupType.get(1), 131 131 name:"Production") 132 132 saveAndTest(personGroupInstance) … … 174 174 personInstance.addToAuthorities(Authority.get(2)) 175 175 personInstance.addToAuthorities(Authority.get(3)) 176 personInstance.addToPersonGroups(PersonGroup. findByName("gnuMims"))176 personInstance.addToPersonGroups(PersonGroup.get(5)) 177 177 178 178 //Person #3 … … 185 185 saveAndTest(personInstance) 186 186 personInstance.addToAuthorities(Authority.get(3)) 187 personInstance.addToPersonGroups(PersonGroup. findByName("Electrical"))187 personInstance.addToPersonGroups(PersonGroup.get(1)) 188 188 } 189 189 … … 203 203 saveAndTest(personInstance) 204 204 personInstance.addToAuthorities(Authority.get(3)) 205 personInstance.addToPersonGroups(PersonGroup. findByName("Electrical"))205 personInstance.addToPersonGroups(PersonGroup.get(1)) 206 206 207 207 //Person #5 … … 214 214 saveAndTest(personInstance) 215 215 personInstance.addToAuthorities(Authority.get(3)) 216 personInstance.addToPersonGroups(PersonGroup. findByName("Mechanical"))216 personInstance.addToPersonGroups(PersonGroup.get(2)) 217 217 218 218 //Person #6 … … 225 225 saveAndTest(personInstance) 226 226 personInstance.addToAuthorities(Authority.get(3)) 227 personInstance.addToPersonGroups(PersonGroup. findByName("Production"))227 personInstance.addToPersonGroups(PersonGroup.get(3)) 228 228 } 229 229 -
trunk/grails-app/views/department/create.gsp
r162 r164 29 29 <tr class="prop"> 30 30 <td valign="top" class="name"> 31 <label for=" costCode">Cost Code:</label>31 <label for="name">Name:</label> 32 32 </td> 33 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:' costCode','errors')}">34 <input type="text" id=" costCode" name="costCode" value="${fieldValue(bean:departmentInstance,field:'costCode')}"/>33 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:'name','errors')}"> 34 <input type="text" id="name" name="name" value="${fieldValue(bean:departmentInstance,field:'name')}"/> 35 35 </td> 36 36 </tr> … … 47 47 <tr class="prop"> 48 48 <td valign="top" class="name"> 49 <label for=" isActive">Is Active:</label>49 <label for="costCode">Cost Code:</label> 50 50 </td> 51 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:' isActive','errors')}">52 < g:checkBox name="isActive" value="${departmentInstance?.isActive}" ></g:checkBox>51 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:'costCode','errors')}"> 52 <input type="text" id="costCode" name="costCode" value="${fieldValue(bean:departmentInstance,field:'costCode')}"/> 53 53 </td> 54 54 </tr> … … 56 56 <tr class="prop"> 57 57 <td valign="top" class="name"> 58 <label for=" name">Name:</label>58 <label for="isActive">Is Active:</label> 59 59 </td> 60 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:' name','errors')}">61 < input type="text" id="name" name="name" value="${fieldValue(bean:departmentInstance,field:'name')}"/>60 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:'isActive','errors')}"> 61 <g:checkBox name="isActive" value="${departmentInstance?.isActive}" ></g:checkBox> 62 62 </td> 63 63 </tr> -
trunk/grails-app/views/department/edit.gsp
r162 r164 32 32 <tr class="prop"> 33 33 <td valign="top" class="name"> 34 <label for=" costCode">Cost Code:</label>34 <label for="name">Name:</label> 35 35 </td> 36 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:' costCode','errors')}">37 <input type="text" id=" costCode" name="costCode" value="${fieldValue(bean:departmentInstance,field:'costCode')}"/>36 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:'name','errors')}"> 37 <input type="text" id="name" name="name" value="${fieldValue(bean:departmentInstance,field:'name')}"/> 38 38 </td> 39 39 </tr> … … 50 50 <tr class="prop"> 51 51 <td valign="top" class="name"> 52 <label for="costCode">Cost Code:</label> 53 </td> 54 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:'costCode','errors')}"> 55 <input type="text" id="costCode" name="costCode" value="${fieldValue(bean:departmentInstance,field:'costCode')}"/> 56 </td> 57 </tr> 58 59 <tr class="prop"> 60 <td valign="top" class="name"> 52 61 <label for="isActive">Is Active:</label> 53 62 </td> … … 59 68 <tr class="prop"> 60 69 <td valign="top" class="name"> 61 <label for=" name">Name:</label>70 <label for="persons">Persons:</label> 62 71 </td> 63 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:'name','errors')}"> 64 <input type="text" id="name" name="name" value="${fieldValue(bean:departmentInstance,field:'name')}"/> 72 <td valign="top" class="value ${hasErrors(bean:departmentInstance,field:'persons','errors')}"> 73 74 <ul> 75 <g:each var="p" in="${departmentInstance?.persons?}"> 76 <li><g:link controller="person" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li> 77 </g:each> 78 </ul> 79 <g:link controller="person" params="['department.id':departmentInstance?.id]" action="create">Add Person</g:link> 80 65 81 </td> 66 82 </tr> -
trunk/grails-app/views/department/list.gsp
r162 r164 24 24 <g:sortableColumn property="id" title="Id" /> 25 25 26 <g:sortableColumn property=" costCode" title="Cost Code" />26 <g:sortableColumn property="name" title="Name" /> 27 27 28 28 <g:sortableColumn property="description" title="Description" /> 29 29 30 <g:sortableColumn property="costCode" title="Cost Code" /> 31 30 32 <g:sortableColumn property="isActive" title="Is Active" /> 31 32 <g:sortableColumn property="name" title="Name" />33 33 34 34 </tr> … … 40 40 <td><g:link action="show" id="${departmentInstance.id}">${fieldValue(bean:departmentInstance, field:'id')}</g:link></td> 41 41 42 <td>${fieldValue(bean:departmentInstance, field:' costCode')}</td>42 <td>${fieldValue(bean:departmentInstance, field:'name')}</td> 43 43 44 44 <td>${fieldValue(bean:departmentInstance, field:'description')}</td> 45 45 46 <td>${fieldValue(bean:departmentInstance, field:'costCode')}</td> 47 46 48 <td>${fieldValue(bean:departmentInstance, field:'isActive')}</td> 47 48 <td>${fieldValue(bean:departmentInstance, field:'name')}</td>49 49 50 50 </tr> -
trunk/grails-app/views/department/show.gsp
r162 r164 31 31 32 32 <tr class="prop"> 33 <td valign="top" class="name"> Cost Code:</td>33 <td valign="top" class="name">Name:</td> 34 34 35 <td valign="top" class="value">${fieldValue(bean:departmentInstance, field:' costCode')}</td>35 <td valign="top" class="value">${fieldValue(bean:departmentInstance, field:'name')}</td> 36 36 37 37 </tr> … … 45 45 46 46 <tr class="prop"> 47 <td valign="top" class="name">Cost Code:</td> 48 49 <td valign="top" class="value">${fieldValue(bean:departmentInstance, field:'costCode')}</td> 50 51 </tr> 52 53 <tr class="prop"> 47 54 <td valign="top" class="name">Is Active:</td> 48 55 … … 52 59 53 60 <tr class="prop"> 54 <td valign="top" class="name"> Name:</td>61 <td valign="top" class="name">Persons:</td> 55 62 56 <td valign="top" class="value">${fieldValue(bean:departmentInstance, field:'name')}</td> 63 <td valign="top" style="text-align:left;" class="value"> 64 <ul> 65 <g:each var="p" in="${departmentInstance.persons}"> 66 <li><g:link controller="person" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li> 67 </g:each> 68 </ul> 69 </td> 57 70 58 71 </tr> -
trunk/grails-app/views/person/create.gsp
r150 r164 93 93 94 94 <tr class="prop"> 95 <td valign="top" class="name"> 96 <label for="department">Department:</label> 97 </td> 98 <td valign="top" class="value ${hasErrors(bean:person,field:'department','errors')}"> 99 <g:select optionKey="id" from="${Department.list()}" name="department.id" value="${person?.department?.id}" noSelection="['null':'']"></g:select> 100 </td> 101 </tr> 102 103 <tr class="prop"> 104 <td valign="top" class="name"> 105 <label for="personGroups">Groups:</label> 106 </td> 107 <td valign="top" class="value ${hasErrors(bean:person,field:'personGroups','errors')}"> 108 <g:select name="personGroups" 109 from="${PersonGroup.list()}" 110 size="5" multiple="yes" optionKey="id" 111 value="${person?.personGroups}" /> 112 113 </td> 114 </tr> 115 116 <tr class="prop"> 95 117 <td valign="top" class="name" align="left">Authorities:</td> 96 118 </tr> -
trunk/grails-app/views/person/edit.gsp
r150 r164 100 100 101 101 <tr class="prop"> 102 <td valign="top" class="name"> 103 <label for="department">Department:</label> 104 </td> 105 <td valign="top" class="value ${hasErrors(bean:person,field:'department','errors')}"> 106 <g:select optionKey="id" from="${Department.list()}" name="department.id" value="${person?.department?.id}" noSelection="['null':'']"></g:select> 107 </td> 108 </tr> 109 110 <tr class="prop"> 111 <td valign="top" class="name"> 112 <label for="personGroups">Groups:</label> 113 </td> 114 <td valign="top" class="value ${hasErrors(bean:person,field:'personGroups','errors')}"> 115 <g:select name="personGroups" 116 from="${PersonGroup.list()}" 117 size="5" multiple="yes" optionKey="id" 118 value="${person?.personGroups}" /> 119 120 </td> 121 </tr> 122 123 <tr class="prop"> 102 124 <td valign="top" class="name" align="left">Authorities:</td> 103 125 </tr> -
trunk/grails-app/views/person/show.gsp
r150 r164 65 65 66 66 <tr class="prop"> 67 <td valign="top" class="name">Department:</td> 68 <td valign="top" class="value">${person.department}</td> 69 </tr> 70 71 <tr class="prop"> 72 <td valign="top" class="name">Groups:</td> 73 <td valign="top" class="value"> 74 <ul> 75 <g:each in="${person.personGroups}" var='group'> 76 <li>${group}</li> 77 </g:each> 78 </ul> 79 </td> 80 </tr> 81 82 <tr class="prop"> 67 83 <td valign="top" class="name">Authorities:</td> 68 84 <td valign="top" class="value">
Note: See TracChangeset
for help on using the changeset viewer.