Put templates on service model

We do a lot of logic around choosing which templates to show. This logic
is all inside one view method.

It makes it cleaner to break this logic up into functions. But this
would mean passing around variables from one function to another.
Putting these methods onto a class (the service model) means that
there’s a place to store this data (rather than having to pass it around
a lot).

Making this code more manageable is important so that when we have
templates and folders it’s easy to encapsulate the logic around
combining the two.
This commit is contained in:
Chris Hill-Scott
2018-10-25 07:59:50 +01:00
parent d69e8b50cd
commit 1e6b79a546
6 changed files with 86 additions and 75 deletions

View File

@@ -72,7 +72,6 @@ def service_dashboard(service_id):
return render_template(
'views/dashboard/dashboard.html',
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
templates=service_api_client.get_service_templates(service_id)['data'],
partials=get_dashboard_partials(service_id)
)