mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 08:31:00 -04:00
Add a specific route for template_type=all
`all` is not a real template type, so for links to template folders that apply to all template types we have a URL that looks like: ``` /services/<uuid:service_id>/templates/folders/<uuid:template_folder_id> ``` However Flask only generates this url when `url_for` is called with `template_type=None`. If called with `template_type=all` then Flask will generate a URL like ``` /services/<uuid:service_id>/templates/all/folders/<uuid:template_folder_id> ``` However attempting to load this URL will now 404, since `all` is not a template type recognised by the regex introduced in https://github.com/alphagov/notifications-admin/pull/3176 It would be nice to not have URLs with `all` in them at all, but since people might have bookmarked them we need to support them indefinitely. Also considered but decided against adding `all` to the set of template types because it might cause other problems, for example attempting to create a new template with a type of `all` would never work.
This commit is contained in:
@@ -108,6 +108,7 @@ def start_tour(service_id, template_id):
|
||||
@main.route("/services/<uuid:service_id>/templates", methods=['GET', 'POST'])
|
||||
@main.route("/services/<uuid:service_id>/templates/folders/<uuid:template_folder_id>", methods=['GET', 'POST'])
|
||||
@main.route("/services/<uuid:service_id>/templates/<template_type:template_type>", methods=['GET', 'POST'])
|
||||
@main.route("/services/<uuid:service_id>/templates/all/folders/<uuid:template_folder_id>", methods=['GET', 'POST'])
|
||||
@main.route("/services/<uuid:service_id>/templates/<template_type:template_type>/folders/<uuid:template_folder_id>", methods=['GET', 'POST'])
|
||||
@user_has_permissions()
|
||||
def choose_template(service_id, template_type='all', template_folder_id=None):
|
||||
|
||||
Reference in New Issue
Block a user