Changeset 39 for trunk/src/grails-app
- Timestamp:
- Jan 27, 2009, 11:02:59 PM (16 years ago)
- Location:
- trunk/src/grails-app
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/grails-app/conf/BootStrap.groovy
r34 r39 5 5 def init = { servletContext -> 6 6 7 println "**** BootStrap ; GrailsUtil.environment:${GrailsUtil.environment}"7 println "**** BootStrap GrailsUtil.environment = ${GrailsUtil.environment}" 8 8 9 9 switch (GrailsUtil.environment) 10 10 { 11 11 case "development": 12 println "**** BootStrap detected development" 13 configureForDevelopment() 12 bootStrapDemoData() 14 13 break 15 14 case "test": 16 println "**** BootStrap detected test"17 configureForTest()18 15 break 19 16 case "production": 20 println "**** BootStrap detected production" 21 configureForProduction() 17 bootStrapDemoData() 22 18 break 23 19 } … … 27 23 def destroy = { 28 24 } 29 30 /* 31 Tasks to do when Grails is running in each environment. 32 */ 33 void configureForDevelopment() 25 26 //Insert some demo/startup data. 27 void bootStrapDemoData() 34 28 { 35 println "BootStrap configureForDevelopment() called"29 println "BootStrapping demo data..." 36 30 37 31 //TypeOfPersonGroup … … 50 44 //Person 51 45 new Person(personGroup:PersonGroup.get(1), 52 firstName:" FirstNameTech1",53 lastName:" LastNameTech1").save()46 firstName:"Craig", 47 lastName:"SuperTech").save() 54 48 new Person(personGroup:PersonGroup.get(2), 55 49 firstName:"Joe", 56 50 lastName:"Samples").save() 51 new Person(personGroup:PersonGroup.get(1), 52 firstName:"Production", 53 lastName:"Mann").save() 57 54 58 55 //TaskGroup … … 82 79 new EntryType(name:"Fault").save() 83 80 new EntryType(name:"WorkDone").save() 81 new EntryType(name:"Production Report").save() 84 82 85 83 //ModificationType … … 93 91 new ModificationType(name:"AssignedToModified").save() 94 92 new ModificationType(name:"NameModified").save() 95 96 93 94 println "BootStrapping demo data...completed." 97 95 98 }99 100 //---------------------------------------------------------101 void configureForTest()102 {103 println "BootStrap configureForTest() called"104 }105 106 //---------------------------------------------------------107 void configureForProduction()108 {109 println "BootStrap configureForProduction() called"110 96 } 111 97 -
trunk/src/grails-app/conf/DataSource.groovy
r16 r39 10 10 cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider' 11 11 } 12 // environment specific settings 12 13 //environment specific settings 14 //create-drop: drop tables and data between sessions, then insert from Bootstrap. 15 //create: drop data between sessions, can't explain the rest. 16 //update: keep data, update tables as required, keeps inserting from BootStrap. 13 17 environments { 14 18 development { … … 26 30 production { 27 31 dataSource { 28 dbCreate = "update" 29 url = "jdbc:hsqldb:file:prodDb;shutdown=true" 32 //Delete dbCreate line after setup! 33 dbCreate = "create-drop" 34 //url = "jdbc:hsqldb:file:prodDb;shutdown=true" 35 url = "jdbc:hsqldb:mem:devDB" 30 36 } 31 37 } -
trunk/src/grails-app/domain/Entry.groovy
r25 r39 4 4 EntryType entryType 5 5 Date date 6 Integer duration 6 Integer durationHours = 0 7 Integer durationMinutes = 0 7 8 String comments 8 9 static hasMany = [persons: Person]10 9 11 10 static belongsTo = [EntryType, Task, Person] 12 11 13 12 static constraints = { 13 task() 14 14 comments(maxSize:500) 15 date() 16 durationHours(min:0) 17 durationMinutes(min:0,max:59) 18 15 19 } 16 20 } -
trunk/src/grails-app/views/entry/create.gsp
r25 r39 29 29 <tr class="prop"> 30 30 <td valign="top" class="name"> 31 <label for="task">Task:</label> 32 </td> 33 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'task','errors')}"> 34 <g:select optionKey="id" from="${Task.list()}" name="task.id" value="${entryInstance?.task?.id}" ></g:select> 35 </td> 36 </tr> 37 38 <tr class="prop"> 39 <td valign="top" class="name"> 31 40 <label for="comments">Comments:</label> 32 41 </td> … … 47 56 <tr class="prop"> 48 57 <td valign="top" class="name"> 49 <label for="duration ">Duration:</label>58 <label for="durationHours">Duration Hours:</label> 50 59 </td> 51 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'duration','errors')}"> 52 <input type="text" id="duration" name="duration" value="${fieldValue(bean:entryInstance,field:'duration')}" /> 60 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'durationHours','errors')}"> 61 <input type="text" id="durationHours" name="durationHours" value="${fieldValue(bean:entryInstance,field:'durationHours')}" /> 62 </td> 63 </tr> 64 65 <tr class="prop"> 66 <td valign="top" class="name"> 67 <label for="durationMinutes">Duration Minutes:</label> 68 </td> 69 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'durationMinutes','errors')}"> 70 <input type="text" id="durationMinutes" name="durationMinutes" value="${fieldValue(bean:entryInstance,field:'durationMinutes')}" /> 53 71 </td> 54 72 </tr> … … 72 90 </tr> 73 91 74 <tr class="prop">75 <td valign="top" class="name">76 <label for="task">Task:</label>77 </td>78 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'task','errors')}">79 <g:select optionKey="id" from="${Task.list()}" name="task.id" value="${entryInstance?.task?.id}" ></g:select>80 </td>81 </tr>82 83 92 </tbody> 84 93 </table> -
trunk/src/grails-app/views/entry/edit.gsp
r25 r39 31 31 <tr class="prop"> 32 32 <td valign="top" class="name"> 33 <label for="task">Task:</label> 34 </td> 35 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'task','errors')}"> 36 <g:select optionKey="id" from="${Task.list()}" name="task.id" value="${entryInstance?.task?.id}" ></g:select> 37 </td> 38 </tr> 39 40 <tr class="prop"> 41 <td valign="top" class="name"> 33 42 <label for="comments">Comments:</label> 34 43 </td> … … 49 58 <tr class="prop"> 50 59 <td valign="top" class="name"> 51 <label for="duration ">Duration:</label>60 <label for="durationHours">Duration Hours:</label> 52 61 </td> 53 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'duration','errors')}"> 54 <input type="text" id="duration" name="duration" value="${fieldValue(bean:entryInstance,field:'duration')}" /> 62 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'durationHours','errors')}"> 63 <input type="text" id="durationHours" name="durationHours" value="${fieldValue(bean:entryInstance,field:'durationHours')}" /> 64 </td> 65 </tr> 66 67 <tr class="prop"> 68 <td valign="top" class="name"> 69 <label for="durationMinutes">Duration Minutes:</label> 70 </td> 71 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'durationMinutes','errors')}"> 72 <input type="text" id="durationMinutes" name="durationMinutes" value="${fieldValue(bean:entryInstance,field:'durationMinutes')}" /> 55 73 </td> 56 74 </tr> … … 74 92 </tr> 75 93 76 <tr class="prop">77 <td valign="top" class="name">78 <label for="persons">Persons:</label>79 </td>80 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'persons','errors')}">81 82 <ul>83 <g:each var="p" in="${entryInstance?.persons?}">84 <li><g:link controller="person" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li>85 </g:each>86 </ul>87 <g:link controller="person" params="['entry.id':entryInstance?.id]" action="create">Add Person</g:link>88 89 </td>90 </tr>91 92 <tr class="prop">93 <td valign="top" class="name">94 <label for="task">Task:</label>95 </td>96 <td valign="top" class="value ${hasErrors(bean:entryInstance,field:'task','errors')}">97 <g:select optionKey="id" from="${Task.list()}" name="task.id" value="${entryInstance?.task?.id}" ></g:select>98 </td>99 </tr>100 101 94 </tbody> 102 95 </table> -
trunk/src/grails-app/views/entry/list.gsp
r25 r39 24 24 <g:sortableColumn property="id" title="Id" /> 25 25 26 <th>Task</th> 27 26 28 <g:sortableColumn property="comments" title="Comments" /> 27 29 28 30 <g:sortableColumn property="date" title="Date" /> 29 31 30 <g:sortableColumn property="duration " title="Duration" />32 <g:sortableColumn property="durationHours" title="Duration Hours" /> 31 33 32 <th>Entry Type</th> 33 34 <th>Person</th> 35 34 <g:sortableColumn property="durationMinutes" title="Duration Minutes" /> 35 36 36 </tr> 37 37 </thead> … … 42 42 <td><g:link action="show" id="${entryInstance.id}">${fieldValue(bean:entryInstance, field:'id')}</g:link></td> 43 43 44 <td>${fieldValue(bean:entryInstance, field:'task')}</td> 45 44 46 <td>${fieldValue(bean:entryInstance, field:'comments')}</td> 45 47 46 48 <td>${fieldValue(bean:entryInstance, field:'date')}</td> 47 49 48 <td>${fieldValue(bean:entryInstance, field:'duration ')}</td>50 <td>${fieldValue(bean:entryInstance, field:'durationHours')}</td> 49 51 50 <td>${fieldValue(bean:entryInstance, field:'entryType')}</td> 51 52 <td>${fieldValue(bean:entryInstance, field:'person')}</td> 52 <td>${fieldValue(bean:entryInstance, field:'durationMinutes')}</td> 53 53 54 54 </tr> -
trunk/src/grails-app/views/entry/show.gsp
r25 r39 31 31 32 32 <tr class="prop"> 33 <td valign="top" class="name">Task:</td> 34 35 <td valign="top" class="value"><g:link controller="task" action="show" id="${entryInstance?.task?.id}">${entryInstance?.task?.encodeAsHTML()}</g:link></td> 36 37 </tr> 38 39 <tr class="prop"> 33 40 <td valign="top" class="name">Comments:</td> 34 41 … … 45 52 46 53 <tr class="prop"> 47 <td valign="top" class="name">Duration :</td>54 <td valign="top" class="name">Duration Hours:</td> 48 55 49 <td valign="top" class="value">${fieldValue(bean:entryInstance, field:'duration')}</td> 56 <td valign="top" class="value">${fieldValue(bean:entryInstance, field:'durationHours')}</td> 57 58 </tr> 59 60 <tr class="prop"> 61 <td valign="top" class="name">Duration Minutes:</td> 62 63 <td valign="top" class="value">${fieldValue(bean:entryInstance, field:'durationMinutes')}</td> 50 64 51 65 </tr> … … 65 79 </tr> 66 80 67 <tr class="prop">68 <td valign="top" class="name">Persons:</td>69 70 <td valign="top" class="value">${fieldValue(bean:entryInstance, field:'persons')}</td>71 72 </tr>73 74 <tr class="prop">75 <td valign="top" class="name">Task:</td>76 77 <td valign="top" class="value"><g:link controller="task" action="show" id="${entryInstance?.task?.id}">${entryInstance?.task?.encodeAsHTML()}</g:link></td>78 79 </tr>80 81 81 </tbody> 82 82 </table>
Note: See TracChangeset
for help on using the changeset viewer.