- Timestamp:
- Feb 22, 2010, 6:35:37 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy
r189 r209 185 185 def description = attrs.remove('description') 186 186 def addExampleElement = attrs.remove('addExampleElement') 187 def addExample2Element = attrs.remove('addExample2Element') 187 188 188 189 // render a form element … … 208 209 } 209 210 211 // add an disabled input box for feedback purposes 212 // @see dateElement(...) 213 if (addExample2Element) { 214 def exampleAttrs = new LinkedHashMap() 215 exampleAttrs.name = attrs.get('name')+'Example2' 216 exampleAttrs.class = 'isExample' 217 exampleAttrs.disabled = 'disabled' 218 exampleAttrs.size = 30 219 out << textField(exampleAttrs) 220 } 221 210 222 out << ' </div>' 211 223 … … 243 255 } 244 256 257 258 /** 259 * render a select form element 260 * @param Map attrs 261 * @param Closure body (help text) 262 */ 263 def selectElement = { attrs, body -> 264 baseElement.call( 265 'select', 266 attrs, 267 body 268 ) 269 } 270 271 /** 272 * render a checkBox form element 273 * @param Map attrs 274 * @param Closure body (help text) 275 */ 276 def checkBoxElement = { attrs, body -> 277 baseElement.call( 278 'checkBox', 279 attrs, 280 body 281 ) 282 } 283 245 284 /** 246 285 * render a dateElement … … 257 296 258 297 // set some textfield values 259 attrs.maxlength = 10298 attrs.maxlength = (attrs.maxlength) ? attrs.maxlength : 10 260 299 attrs.addExampleElement = true 261 300 … … 267 306 ) 268 307 } 308 309 /** 310 * render a dateElement 311 * NOTE: datepicker is attached through wizard.js! 312 * @param Map attrs 313 * @param Closure body (help text) 314 */ 315 def timeElement = { attrs, body -> 316 // transform value? 317 if (attrs.value instanceof Date) { 318 // transform date instance to formatted string (dd/mm/yyyy) 319 attrs.value = String.format('%td/%<tm/%<tY %<tH:%<tM', attrs.value) 320 } 321 322 attrs.addExampleElement = true 323 attrs.addExample2Element = true 324 attrs.maxlength = 16 325 326 // render a normal text field 327 //out << textFieldElement(attrs,body) 328 textFieldElement.call( 329 attrs, 330 body 331 ) 332 } 269 333 270 334 /** … … 283 347 284 348 /** 349 * Button form element 350 * @param Map attributes 351 * @param Closure help content 352 */ 353 def buttonElement = { attrs, body -> 354 // render template element 355 baseElement.call( 356 'ajaxButton', 357 attrs, 358 body 359 ) 360 } 361 362 /** 285 363 * render a species select element 286 364 * @param Map attrs … … 289 367 // fetch the speciesOntology 290 368 // note that this is a bit nasty, probably the ontologyName should 291 // be configured in a configuration file... --> TODO 369 // be configured in a configuration file... --> TODO: centralize species configuration 292 370 def speciesOntology = Ontology.findByName('NCBI Taxonomy') 293 371 … … 331 409 } 332 410 411 out << select(attrs) 412 } 413 414 /** 415 * Term form element 416 * @param Map attributes 417 * @param Closure help content 418 */ 419 def termElement = { attrs, body -> 420 // render term element 421 baseElement.call( 422 'termSelect', 423 attrs, 424 body 425 ) 426 } 427 428 /** 429 * render a term select element 430 * @param Map attrs 431 */ 432 def termSelect = { attrs -> 433 // fetch all terms 434 attrs.from = Term.findAll() // for now, all terms as we cannot identify terms as being treatment terms... 435 436 // got a name? 437 if (!attrs.name) { 438 attrs.name = 'term' 439 } 440 333 441 out << select(attrs) 334 442 }
Note: See TracChangeset
for help on using the changeset viewer.