Display notes section in Service Settings

This commit is contained in:
Pea Tyczynska
2021-01-13 18:48:20 +00:00
parent 9058edca90
commit 89b3f6ace2
5 changed files with 28 additions and 6 deletions

View File

@@ -156,6 +156,18 @@
}
td.table-field-wrap-text {
div {
white-space: normal;
}
ul li {
margin-bottom: 5px;
}
}
.table-heading {
margin-bottom: 20px;
}

View File

@@ -37,6 +37,7 @@ class Service(JSONModel):
'message_limit',
'rate_limit',
'name',
'notes',
'prefix_sms',
'research_mode',
'service_callback_api',

View File

@@ -63,12 +63,13 @@
{% endif %}
{%- endmacro %}
{% macro field(align='left', status='', border=True, colspan=None) -%}
{% macro field(align='left', status='', border=True, colspan=None, wrap=False) -%}
{% set field_alignment = 'table-field-right-aligned' if align == 'right' else 'table-field-left-aligned' %}
{% set border = '' if border else 'table-field-noborder' %}
{% set wrap = 'table-field-wrap-text' if wrap else '' %}
<td class="{{ [field_alignment, border]|join(' ') }}" {% if colspan %}colspan="{{ colspan }}"{% endif %}>
<td class="{{ [field_alignment, border, wrap]|join(' ') }}" {% if colspan %}colspan="{{ colspan }}"{% endif %}>
<div class="{{ 'table-field-status-' + status if status }}">{{ caller() }}</div>
</td>
{%- endmacro %}
@@ -85,8 +86,8 @@
</td>
{%- endmacro %}
{% macro text_field(text, status='', truncate=false) -%}
{% call field(status=status) %}
{% macro text_field(text, status='', truncate=false, wrap=False) -%}
{% call field(status=status, wrap=wrap) %}
{% if text is iterable and text is not string %}
<ul>
{% for item in text %}
@@ -105,11 +106,12 @@
{% endcall %}
{%- endmacro %}
{% macro optional_text_field(text, default='Not set', truncate=false) -%}
{% macro optional_text_field(text, default='Not set', truncate=false, wrap=False) -%}
{{ text_field(
text or default,
status='' if text else 'default',
truncate=truncate
truncate=truncate,
wrap=wrap
) }}
{%- endmacro %}

View File

@@ -335,6 +335,12 @@
{{ edit_field('Change', url_for('.service_switch_count_as_live', service_id=current_service.id), suffix='if service is counted in list of live services') }}
{% endcall %}
{% call row() %}
{{ text_field('Notes')}}
{{ optional_text_field(current_service.notes, default="No notes yet", wrap=True) }}
{{ edit_field('Change', url_for('.service_switch_count_as_live', service_id=current_service.id), suffix='the notes for the service') }}
{% endcall %}
{% call row() %}
{{ text_field('Organisation')}}
{% call field() %}

View File

@@ -100,6 +100,7 @@ def mock_get_service_settings_page_common(
'Label Value Action',
'Live Off Change service status',
'Count in list of live services Yes Change if service is counted in list of live services',
'Notes No notes yet Change the notes for the service',
'Organisation Test organisation Central government Change organisation for service',
'Rate limit 3,000 per minute Change rate limit',
'Message limit 1,000 per day Change daily message limit',