Changeset 533
- Timestamp:
- Jun 4, 2010, 3:33:43 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r532 r533 91 91 flow.remove('eventGroups') 92 92 flow.remove('eventTemplates') 93 94 // set 'quicksave' variable 95 flow.quickSave = false 93 96 }.to "study" 94 97 on("modify").to "modify" … … 111 114 // load study 112 115 try { 116 // load study 113 117 flow.study = Study.findByTitle(params.study) 114 118 … … 183 187 } 184 188 189 // set 'quicksave' variable 190 flow.quickSave = true 191 185 192 success() 186 193 } catch (Exception e) { … … 242 249 } 243 250 }.to "subjects" 251 on("quickSave") { 252 flash.errors = [:] 253 254 if (this.handleStudy(flow, flash, params)) { 255 success() 256 } else { 257 error() 258 } 259 }.to "waitForSave" 244 260 } 245 261 … … 299 315 success() 300 316 }.to "subjects" 317 on("delete") { 318 // handle subjects 319 this.handleSubjects(flow, flash, params) 320 321 flash.errors = [:] 322 def delete = params.get('do') as int; 323 324 // remove subject 325 if (flow.subjects[ delete ] && flow.subjects[ delete ] instanceof Subject) { 326 // remove subject from templates 327 flow.subjectTemplates.each() { templateName, templateData -> 328 templateData.subjects.remove( delete ) 329 } 330 331 // remove subject altogether 332 flow.subjects.remove( delete ) 333 } 334 }.to "subjects" 335 on("previous") { 336 flash.errors = [:] 337 338 // handle form data 339 if (!this.handleSubjects(flow, flash, params)) { 340 error() 341 } else { 342 success() 343 } 344 }.to "study" 301 345 on("next") { 302 346 flash.errors = [:] … … 314 358 } 315 359 }.to "events" 316 on("delete") { 317 // handle subjects 318 this.handleSubjects(flow, flash, params) 319 320 flash.errors = [:] 321 def delete = params.get('do') as int; 322 323 // remove subject 324 if (flow.subjects[ delete ] && flow.subjects[ delete ] instanceof Subject) { 325 // remove subject from templates 326 flow.subjectTemplates.each() { templateName, templateData -> 327 templateData.subjects.remove( delete ) 328 } 329 330 // remove subject altogether 331 flow.subjects.remove( delete ) 332 } 333 }.to "subjects" 334 on("previous") { 335 flash.errors = [:] 336 337 // handle form data 338 if (!this.handleSubjects(flow, flash, params)) { 360 on("quickSave") { 361 flash.errors = [:] 362 363 // check if we have at least one subject 364 // and check form data 365 if (flow.subjects.size() < 1) { 366 // append error map 367 this.appendErrorMap(['subjects': 'You need at least to create one subject for your study'], flash.errors) 368 error() 369 } else if (!this.handleSubjects(flow, flash, params)) { 339 370 error() 340 371 } else { 341 372 success() 342 373 } 343 }.to " study"374 }.to "waitForSave" 344 375 } 345 376 … … 497 528 } 498 529 }.to "groups" 530 on("quickSave") { 531 flash.values = params 532 flash.errors = [:] 533 534 // handle study data 535 if (flow.events.size() < 1) { 536 // append error map 537 this.appendErrorMap(['events': 'You need at least to create one event for your study'], flash.errors) 538 error() 539 } else if (this.handleEvents(flow, flash, params)) { 540 success() 541 } else { 542 error() 543 } 544 }.to "waitForSave" 499 545 } 500 546 … … 514 560 success() 515 561 }.to "samples" 562 on("quickSave") { 563 this.handleSubjectGrouping(flow, flash, params) 564 success() 565 }.to "waitForSave" 516 566 } 517 567 … … 547 597 success() 548 598 }.to "confirm" 599 on("quickSave") { 600 success() 601 }.to "waitForSave" 549 602 } 550 603 -
trunk/grails-app/views/wizard/common/_navigation.gsp
r527 r533 19 19 [ <wizard:ajaxButton name="cancel" value="cancel" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" class="prevnext" /> ] 20 20 </g:if> 21 <g:if test="${quickSave && page<pages.size}"> 22 [ <wizard:ajaxButton name="quickSave" value="quick save" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" class="prevnext" /> ] 23 </g:if> 21 24 <g:elseif test="${page>1 && page<pages.size}"> 22 25 |
Note: See TracChangeset
for help on using the changeset viewer.