- Timestamp:
- Jan 14, 2010, 5:44:28 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy
r88 r89 20 20 // define the AJAX provider to use 21 21 static ajaxProvider = "jquery" 22 23 // define default text field width 24 static defaultTextFieldSize = 25; 22 25 23 26 /** … … 32 35 * @todo perhaps some methods should be moved to a more generic 33 36 * 'webflow' taglib 34 * @param map attributes35 * @param stringbody37 * @param Map attributes 38 * @param Closure body 36 39 */ 37 40 def ajaxButton = { attrs, body -> … … 76 79 } 77 80 81 /** 82 * render the content of a particular wizard page 83 * @param Map attrs 84 * @param Closure body 85 */ 78 86 def pageContent = { attrs, body -> 79 87 // define AJAX provider … … 87 95 out << render(template:"/wizard/common/navigation") 88 96 } 97 98 def textFieldElement = { attrs, body -> 99 // set default size, or scale to max length if it is less than the default size 100 if (!attrs.get("size")) { 101 if (attrs.get("maxlength")) { 102 attrs.size = ((attrs.get("maxlength") as int) > defaultTextFieldSize) ? defaultTextFieldSize : attrs.get("maxlength") 103 } else { 104 attrs.size = defaultTextFieldSize 105 } 106 } 107 108 // render a text element 109 out << '<div class="element">' 110 out << ' <div class="description">' 111 out << body() 112 out << ' </div>' 113 out << ' <div class="input">' 114 out << textField(attrs) 115 out << ' </div>' 116 117 // add help icon? 118 if (attrs.get('help')) { 119 out << ' <div class="help"><img src="../images/icons/famfamfam/help.png"></div>' 120 } 121 122 out << '</div>' 123 } 89 124 }
Note: See TracChangeset
for help on using the changeset viewer.