Refactor settings page to use service model

There’s a lot of code in service settings which:
- talks to the API directly through the clients
- passes that information through to the Jinja template

By encapsulating this logic in the service model:
- the Jinja template can access the data directly
- the logic can be reused across multiple methods
This commit is contained in:
Chris Hill-Scott
2018-10-26 17:31:49 +01:00
parent 526f2d7900
commit 1e2608d2e0
12 changed files with 199 additions and 159 deletions

View File

@@ -25,7 +25,7 @@
</div>
</div>
<div class="user-list">
{% if not data_retention_settings %}
{% if not current_service.data_retention %}
<div class="user-list-item">
<span class="hint">You havent added any data retention</span>
</div>
@@ -36,7 +36,7 @@
field_headings_visible=False,
caption_visible=False
) %}
{% for item in data_retention_settings %}
{% for item in current_service.data_retention %}
{% call row() %}
{{ text_field(item.notification_type | format_notification_type)}}
{{ text_field(item.days_of_retention) }}