[IMP] website_event: allow to add values before rendering the registration template
Sub-modules will need to add new values before rendering the registration template. This will be used to be able to display more information in those modules, e.g. a toast message when being redirected to register. For that purpose we create a method to prepare those values and separate value creation from template rendering itself. LINKS PR #55260 Task ID-2310491 (Event Online Preparation 5) Part of Task ID-2252655 (Main Online Event task) Part of Task ID-2283796 (Event B2Basics / Registration Flow)
This commit is contained in:
committed by
Thibault Delavallée
parent
0816bc90d4
commit
39325e9ce7
@@ -207,15 +207,19 @@ class WebsiteEventController(http.Controller):
|
||||
if not event.can_access_from_current_website():
|
||||
raise werkzeug.exceptions.NotFound()
|
||||
|
||||
values = self._prepare_event_register_values(event, **post)
|
||||
return request.render("website_event.event_description_full", values)
|
||||
|
||||
def _prepare_event_register_values(self, event, **post):
|
||||
"""Return the require values to render the template."""
|
||||
urls = event._get_event_resource_urls()
|
||||
values = {
|
||||
return {
|
||||
'event': event,
|
||||
'main_object': event,
|
||||
'range': range,
|
||||
'google_url': urls.get('google_url'),
|
||||
'iCal_url': urls.get('iCal_url'),
|
||||
}
|
||||
return request.render("website_event.event_description_full", values)
|
||||
|
||||
@http.route('/event/add_event', type='json', auth="user", methods=['POST'], website=True)
|
||||
def add_event(self, event_name="New Event", **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user