Changeset 103
- Timestamp:
- Jan 21, 2010, 1:56:10 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 deleted
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r101 r103 48 48 flow.page = 0 49 49 flow.pages = [ 50 [title: ' Een'],50 [title: 'Study'], 51 51 [title: 'Twoooo'], 52 52 [title: 'Trois'] … … 61 61 flow.page = 1 62 62 } 63 on("next").to " pageOne"63 on("next").to "study" 64 64 } 65 65 66 pageOne{67 render(view: "_ one")66 study { 67 render(view: "_study") 68 68 onRender { 69 69 println "render page one" … … 72 72 on("next") { 73 73 // create a study instance 74 /*75 74 println params 76 defstudy = new Study(params)75 flow.study = new Study(params) 77 76 78 79 if ( study.validate()) {77 // validate study 78 if (flow.study.validate()) { 80 79 println "study validates" 81 80 } else { 81 // validation failed, feedback errors 82 flash.errors = new LinkedHashMap() 83 this.appendErrors(flow.study,flash.errors) 82 84 println "errorrrs" 85 println flash.errors 83 86 error() 84 87 } 85 */86 88 }.to "pageTwo" 87 89 } … … 99 101 on("previous") { 100 102 println "previous page!" 101 }.to " pageOne"103 }.to "study" 102 104 } 103 105 … … 114 116 } 115 117 } 118 119 /** 120 * transform domain class validation errors into a human readable 121 * linked hash map 122 * @param object validated domain class 123 * @returns object linkedHashMap 124 */ 125 def getHumanReadableErrors(object) { 126 def errors = new LinkedHashMap() 127 128 object.errors.getAllErrors().each() { 129 errors[it.getArguments()[0]] = it.getDefaultMessage() 130 } 131 132 return errors 133 } 134 135 /** 136 * append errors of a particular object to a map 137 * @param object 138 * @param map linkedHashMap 139 * @void 140 */ 141 def appendErrors(object, map) { 142 this.appendErrorMap(this.getHumanReadableErrors(object), map) 143 } 144 145 /** 146 * append errors of one map to another map 147 * @param map linkedHashMap 148 * @param map linkedHashMap 149 * @void 150 */ 151 def appendErrorMap(map, mapToExtend) { 152 map.each() {key, value -> 153 mapToExtend[key] = value 154 } 155 } 156 116 157 } -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r101 r103 3 3 /** 4 4 * Domain class describing the basic entity in the study capture part: the Study class. 5 * 6 * Revision information: 7 * $Rev$ 8 * $Author$ 9 * $Date$ 5 10 */ 6 class Study {11 class Study implements Serializable { 7 12 nimble.User owner 8 13 String title … … 16 21 Template template 17 22 18 static hasMany = [editors: nimble.User, readers: nimble.User, 19 subjects: Subject, groups: SubjectGroup, 20 events: Event, samplingEvents: SamplingEvent] 23 static hasMany = [ editors: nimble.User, 24 readers: nimble.User, 25 subjects: Subject, 26 groups: SubjectGroup, 27 events: Event, 28 samplingEvents: SamplingEvent 29 ] 21 30 22 31 static constraints = { … … 31 40 } 32 41 33 def String toString() { 34 return title; 35 } 36 37 42 def String toString() { 43 return title; 44 } 38 45 } -
trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy
r101 r103 182 182 out << '</div>' 183 183 out << render(template: "/wizard/common/navigation") 184 out << render(template: "/wizard/common/error") 184 185 } 185 186 -
trunk/grails-app/views/wizard/common/_error.gsp
r88 r103 1 1 <% 2 /**3 * Wizard error template4 *5 * @authorJeroen Wesbeek6 * @since201001147 * @package wizard8 * @seedbnp.studycapturing.WizardTagLib9 * @seedbnp.studycapturing.WizardController10 *11 * Revision information:12 * $Rev$13 * $Author$14 * $Date$15 */2 /** 3 * Wizard error template 4 * 5 * @author Jeroen Wesbeek 6 * @since 20100114 7 * @package wizard 8 * @see dbnp.studycapturing.WizardTagLib 9 * @see dbnp.studycapturing.WizardController 10 * 11 * Revision information: 12 * $Rev$ 13 * $Author$ 14 * $Date$ 15 */ 16 16 %> 17 <div id="wizardError" class="error"/> 17 <g:if test="${errors}"> 18 <div id="wizardError" class="error" title="errors"> 19 <g:each in="${errors}" var="error" status="e"> 20 <p> 21 <g:if test="${!e}"><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span></g:if> 22 ${error.key} → ${error.value} 23 </p> 24 </g:each> 25 </div> 26 <script type="text/javascript"> 27 $(function() { 28 $("div#wizardError").dialog({ 29 bgiframe: true, 30 modal: true, 31 width: 600, 32 buttons: { 33 Ok: function() { 34 $(this).dialog('close'); 35 } 36 } 37 }); 38 }); 39 </script> 40 </g:if> -
trunk/grails-app/views/wizard/common/_wizard.gsp
r102 r103 21 21 <wizard:ajaxFlowRedirect form="form#wizardForm" name="next" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="attachHelpTooltips()" /> 22 22 </div> 23 < g:render template="common/error"/>23 <!--g:render template="common/error"//--> 24 24 </g:form> 25 25 </div>
Note: See TracChangeset
for help on using the changeset viewer.