Changeset 138
- Timestamp:
- Jan 26, 2010, 4:46:01 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r136 r138 18 18 class BootStrap { 19 19 def init = {servletContext -> 20 // define timezone 21 System.setProperty('user.timezone', 'CET') 20 22 21 23 if (GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT) { -
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r105 r138 2 2 3 3 import dbnp.studycapturing.* 4 import dbnp.data.* 4 5 import grails.converters.* 5 6 … … 49 50 flow.pages = [ 50 51 [title: 'Study'], // study 51 [title: ' Twoooo'],52 [title: ' Trois']52 [title: 'Subjects'], // subjects 53 [title: 'Form elements demo page'] 53 54 ] 54 55 … … 75 76 } 76 77 on("next") { 78 // create date instance from date string? 79 // @see WizardTagLibrary::dateElement{...} 80 if (params.get('startDate')) { 81 params.startDate = new Date().parse("d/M/yyyy", params.get('startDate').toString()) 82 } 83 77 84 // create a study instance 78 85 flow.study = new Study(params) … … 80 87 // validate study 81 88 if (flow.study.validate()) { 89 println "ok" 82 90 success() 83 91 } else { … … 87 95 error() 88 96 } 89 }.to " pageTwo"97 }.to "subjects" 90 98 } 91 99 92 100 // render page two 93 pageTwo{94 render(view: "_ two")101 subjects { 102 render(view: "_subjects") 95 103 onRender { 96 println "render page two"97 104 flow.page = 2 105 106 if (!flow.subjects) { 107 flow.subjects = new LinkedHashMap() 108 } 98 109 } 110 on ("add") { 111 def speciesTerm = Term.findByName(params.addSpecies) 112 113 // add x subject of species y 114 (params.addNumber as int).times { 115 def increment = flow.subjects.size() 116 flow.subjects[ increment ] = new Subject( 117 name: 'Subject ' + (increment+1), 118 species: speciesTerm 119 ) 120 } 121 }.to "subjects" 99 122 on("next") { 100 println "next page!" 123 // got one or more subjects? 124 if (flow.subjects.size() < 1) { 125 error() 126 } 101 127 }.to "pageThree" 102 128 on("previous") { 103 println "previous page!" 129 // handle data? 130 // go to study page 104 131 }.to "study" 105 132 } … … 114 141 on("previous") { 115 142 println "previous page!" 116 }.to " pageTwo"143 }.to "subjects" 117 144 } 118 145 } -
trunk/grails-app/domain/dbnp/data/Term.groovy
r106 r138 7 7 * The Term object should point to an existing term in an online ontology, therefore instances of this class can also 8 8 * be seen as a cache of elements of the external ontology. 9 * 10 * Revision information: 11 * $Rev$ 12 * $Author$ 13 * $Date$ 9 14 */ 10 class Term { 15 class Term implements Serializable { 16 String name 17 Ontology ontology 18 String accession 11 19 12 String name 13 Ontology ontology 14 String accession 20 static constraints = { 21 } 15 22 16 static constraints = { 17 } 18 19 def String toString() { 20 return name 21 } 22 23 23 def String toString() { 24 return name 25 } 24 26 } -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r136 r138 9 9 * $Date$ 10 10 */ 11 class Study {11 class Study implements Serializable { 12 12 nimble.User owner 13 13 String title … … 21 21 Template template 22 22 23 static hasMany = [ editors: 24 readers:nimble.User,25 subjects:Subject,26 groups:SubjectGroup,27 events:Event,28 samplingEvents:SamplingEvent23 static hasMany = [ editors: nimble.User, 24 readers: nimble.User, 25 subjects: Subject, 26 groups: SubjectGroup, 27 events: Event, 28 samplingEvents: SamplingEvent 29 29 ] 30 30 -
trunk/grails-app/domain/dbnp/studycapturing/Subject.groovy
r136 r138 1 1 package dbnp.studycapturing 2 3 2 import dbnp.data.Term 4 3 5 4 /** 6 5 * This domain class describes the subjects in a study. 6 * 7 * Revision information: 8 * $Rev$ 9 * $Author$ 10 * $Date$ 7 11 */ 8 class Subject { 9 12 class Subject implements Serializable { 10 13 String name 11 14 Term species … … 16 19 17 20 static hasMany = [ 18 templateStringFields: String,19 templateNumberFields 20 templateStringListFields 21 templateTermFields 21 templateStringFields: String, 22 templateNumberFields: float, 23 templateStringListFields: String, 24 templateTermFields: Term 22 25 ] 23 26 24 27 static constraints = { 25 28 } -
trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy
r107 r138 2 2 3 3 import org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib 4 import dbnp.data.Term 4 5 5 6 /** … … 90 91 91 92 // replace double semi colons 92 button = button.replaceAll(/;{2,}/, ' !!!')93 button = button.replaceAll(/;{2,}/, ';') 93 94 94 95 // render button … … 236 237 */ 237 238 def dateElement = { attrs, body -> 239 // transform value? 240 if (attrs.value instanceof Date) { 241 // transform date instance to formatted string (dd/mm/yyyy) 242 attrs.value = String.format('%td/%<tm/%<tY', attrs.value) 243 } 244 238 245 // set some textfield values 239 246 attrs.maxlength = 10 … … 246 253 out << '<script type="text/javascript">' 247 254 out << '$(document).ready(function() {' 248 out << ' $("#' + attrs.get('name') + '").datepicker({altField: \'#' + attrs.get('name') + 'Example\', altFormat: \'DD, d MM, yy\'});' 255 out << ' $("#' + attrs.get('name') + '").datepicker({' 256 out << ' dateFormat: \'dd/mm/yy\',' 257 out << ' altField: \'#' + attrs.get('name') + 'Example\', altFormat: \'DD, d MM, yy\'' 258 out << ' });' 249 259 out << '});' 250 260 out << '</script>' 251 261 } 262 263 /** 264 * render a species select element 265 * @param Map attrs 266 * @param Closure body (help text) 267 */ 268 def speciesSelect = { attrs, body -> 269 // fetch all species 270 attrs.from = Term.findAll() // for now, all terms, should be refactored to be species ontology only! 271 272 // got a name? 273 if (!attrs.name) { 274 attrs.name = 'species' 275 } 276 277 out << select(attrs) 278 } 252 279 } -
trunk/grails-app/views/wizard/pages/_subjects.gsp
r130 r138 1 1 <% 2 2 /** 3 * Wizard page two3 * Subjects page 4 4 * 5 5 * @author Jeroen Wesbeek … … 16 16 %> 17 17 <wizard:pageContent> 18 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales porta enim, sed ornare sapien molestie mollis. Maecenas at pretium turpis. Duis fermentum lectus vitae nisl venenatis id hendrerit sapien dictum. Duis blandit ornare augue nec porttitor. Quisque at tortor sapien, ac volutpat sem. Nullam venenatis placerat risus a euismod. Donec massa dui, porttitor sed fermentum eu, ornare ac velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In id odio nisl, non semper neque. Vivamus facilisis, neque sed lacinia blandit, odio nisi sagittis turpis, accumsan iaculis tellus magna at velit. In sed turpis metus. Phasellus id sem eget dui sollicitudin ultrices. Duis cursus vehicula diam vel pharetra. Donec mattis libero eget tortor venenatis at cursus felis scelerisque. Nunc hendrerit metus quis leo sollicitudin sodales. In urna quam, aliquet in eleifend eget, rutrum tempor elit.</p> 19 20 <p>Suspendisse magna mauris, pretium eget elementum sed, aliquam nec neque. Nam et lorem lacus. Phasellus dapibus, erat nec tristique commodo, turpis tellus tempor est, tincidunt dignissim urna tortor at dui. Nulla faucibus, velit in lobortis venenatis, neque sapien lobortis neque, ut varius sem tortor id purus. Duis posuere condimentum ante, quis mattis arcu fringilla quis. Vivamus in augue tellus, posuere mattis nisl. Praesent sit amet ligula a turpis ullamcorper elementum non quis felis. Nulla elit ipsum, viverra ut cursus at, pharetra eget nibh. Vivamus mauris velit, elementum eu ornare vitae, imperdiet id velit. Phasellus sit amet mi vel est lobortis sagittis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. </p> 18 <wizard:ajaxButton name="add" value="Add" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="attachHelpTooltips()" /> 19 <input name="addNumber" size="4" maxlength="4" value="1"> 20 subjects of species 21 <wizard:speciesSelect name="addSpecies" /> 22 <g:if test="${subjects}"> 23 <div class="subjects"> 24 <g:each var="subject" status="i" in="${subjects}"> 25 <div class="subject<g:if test="${i>0}"> topborder</g:if>"> 26 <div class="row">subject ${i}</div> 27 <div class="row">${subject}</div> 28 </div> 29 </g:each> 30 </div> 31 </g:if> 21 32 </wizard:pageContent> -
trunk/grails-app/views/wizard/pages/_three.gsp
r101 r138 30 30 <p>Nullam a blandit quam. Cras porta tempus lectus, vel varius lacus vulputate in. Aenean ac nunc lectus, hendrerit tempor elit. Sed ut varius diam.</p> 31 31 </wizard:textFieldElement> 32 <wizard:dateElement name="startDate" description="Date element" error="startDate" value="${study?.startDate}"> 33 <object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/2WNrx2jq184&hl=en_US&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2WNrx2jq184&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object> 34 </wizard:dateElement> 32 35 </wizard:pageContent> -
trunk/web-app/css/wizard.css
r107 r138 122 122 display: none; 123 123 } 124 125 .wizard .subjects { 126 display: block; 127 /* 128 background-color: #c0ddea; 129 border: 1px solid #575a5d; 130 margin-top: 2px; 131 */ 132 border: 1px solid #575a5d; 133 background-color: #ebf7fc; 134 margin-top: 10px; 135 } 136 137 .wizard .subjects .subject { 138 display: block; 139 } 140 141 .wizard .topborder { 142 border-top: 1px solid #8e908f; 143 } 144 145 .wizard .subjects .subject .row { 146 display: inline-block; 147 /* 148 border: 1px solid #575a5d; 149 margin: 1px 1px 0px 0px; 150 */ 151 }
Note: See TracChangeset
for help on using the changeset viewer.