Changeset 14648
- Timestamp:
- 23 Mar 2017, 04:43:44 (8 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r14642 r14648 4 4 1.6.dev0 (unreleased) 5 5 ======================= 6 7 * Redirect to manage page after editing of certificate courses. 6 8 7 9 * Add `course_category` attribute to course tickets. In the base package, -
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r14646 r14648 2577 2577 doclink = DOCLINK + '/academics.html#certificate-courses' 2578 2578 2579 @action(_('Save and return'), style='primary')2580 def save AndReturn(self, **data):2579 @action(_('Save'), style='primary') 2580 def save(self, **data): 2581 2581 parent = self.context.__parent__ 2582 2582 if self.context.level == data['level']: … … 2587 2587 old_level = self.context.level 2588 2588 data['course'] = self.context.course 2589 parent.addCertCourse(**data) 2589 try: 2590 parent.addCertCourse(**data) 2591 except KeyError: 2592 self.flash(_('The chosen certificate course is already ' 2593 'part of this certificate.'), type='warning') 2594 return 2590 2595 parent.delCertCourses(data['course'].code, level=old_level) 2591 2596 self.flash(_('Form has been saved.')) … … 2595 2600 grok.getSite().logger.info( 2596 2601 '%s - renamed: %s to %s' % (ob_class, old_code, new_code)) 2597 self.redirect(self.url(parent)) 2602 self.redirect(self.url(parent) + '/%s_%s/@@manage' % ( 2603 data['course'].code, data['level'])) 2598 2604 return 2599 2605 -
main/waeup.kofa/trunk/src/waeup/kofa/doctests/pages.txt
r13657 r14648 1096 1096 If we just click 'Save and return' nothing will change: 1097 1097 1098 >>> browser.getControl("Save and return").click() 1099 >>> browser.getLink('COURSE1_100').click() 1098 >>> browser.getControl("Save").click() 1100 1099 >>> browser.url 1101 'http://localhost/myun.../TF/TD/certificates/CERT1/COURSE1_100 '1102 1103 Let's set a new level (it was 100 before) and save the form. Th is will1104 bring us to the certificate index page afterwards: 1105 1106 >>> browser.open(cert_url + '/COURSE1_100/manage') 1100 'http://localhost/myun.../TF/TD/certificates/CERT1/COURSE1_100/@@manage' 1101 1102 Let's set a new level (it was 100 before) and save the form. The entire 1103 certificate course will be replaced and we will be redirected to manage 1104 page afterwards: 1105 1107 1106 >>> browser.getControl(name='form.level').value = ['200'] 1108 >>> browser.getControl("Save and return").click() 1109 1110 As we changed the level, also the URL will change: 1111 1112 >>> browser.getLink('COURSE1_200').click() 1107 >>> browser.getControl("Save").click() 1108 >>> browser.url 1109 'http://localhost/myun.../TF/TD/certificates/CERT1/COURSE1_200/@@manage' 1110 1111 Nothing will be changed if click ``Cancel``: 1112 1113 >>> browser.getControl(name='form.level').value = ['400'] 1114 >>> browser.getControl('Cancel').click() 1113 1115 >>> browser.url 1114 1116 'http://localhost/myun.../TF/TD/certificates/CERT1/COURSE1_200' 1115 1116 If we go to the settings page and click ``Cancel`` nothing will be1117 changed:1118 1119 >>> browser.getLink('Edit certificate course').click()1120 >>> browser.getControl(name='form.level').value = ['400']1121 >>> browser.getControl('Cancel').click()1122 1123 Our certcourse provides a new level of 200 and not 400:1124 1125 >>> browser.open(cert_url + '/COURSE1_200')1126 >>> print browser.contents1127 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"1128 ...<td>Level:</td>1129 ...<td>200 (Year 2)</td>1130 ...1131 1117 1132 1118 Searching certificate courses
Note: See TracChangeset for help on using the changeset viewer.