diff --git a/app/assets/stylesheets/components/table.scss b/app/assets/stylesheets/components/table.scss
index cd9b1643f..0209b4d44 100644
--- a/app/assets/stylesheets/components/table.scss
+++ b/app/assets/stylesheets/components/table.scss
@@ -51,6 +51,48 @@
}
+.settings-table {
+
+ table {
+ table-layout: fixed;
+ }
+
+ th {
+
+ &:first-child {
+ width: 35%; // 33.33% + fudge
+ }
+
+ &:last-child {
+ width: 17.5% // 16.67% + fudge
+ }
+
+ }
+
+ td.table-field-left-aligned {
+
+ &:first-child {
+
+ div {
+ white-space: normal;
+ }
+
+ }
+
+ div {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ ul li {
+ margin-bottom: 5px;
+ }
+
+ }
+
+}
+
%table-field,
.table-field {
diff --git a/app/templates/components/table.html b/app/templates/components/table.html
index c5708512c..656ef1c47 100644
--- a/app/templates/components/table.html
+++ b/app/templates/components/table.html
@@ -67,7 +67,7 @@
{% macro field(align='left', status='', border=True) -%}
- {% set field_alignment = 'table-field-right-aligned' if align == 'right' else 'table-field-center-aligned' %}
+ {% set field_alignment = 'table-field-right-aligned' if align == 'right' else 'table-field-left-aligned' %}
{% set border = '' if border else 'table-field-noborder' %}
@@ -90,7 +90,7 @@
{% macro text_field(text, status='', truncate=false) -%}
{% call field(status=status) %}
{% if text is iterable and text is not string %}
-
+
{% for item in text %}
{% if item %}
- {{ item }}
diff --git a/app/templates/views/organisations/organisation/settings/index.html b/app/templates/views/organisations/organisation/settings/index.html
index 59739904b..a08f70d32 100644
--- a/app/templates/views/organisations/organisation/settings/index.html
+++ b/app/templates/views/organisations/organisation/settings/index.html
@@ -29,7 +29,7 @@
{% if current_user.platform_admin %}
Platform admin settings
-
+
{% call mapping_table(
caption='Platform admin settings',
field_headings=['Label', 'Value', 'Action'],
diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html
index 6b81af730..3332474f3 100644
--- a/app/templates/views/service-settings.html
+++ b/app/templates/views/service-settings.html
@@ -10,7 +10,7 @@
Settings
-
+
{% call mapping_table(
caption='General',
@@ -278,98 +278,105 @@
{% if current_user.platform_admin %}
- Platform admin settings
- {% call mapping_table(
- caption='Settings',
- field_headings=['Label', 'Value', 'Action'],
- field_headings_visible=False,
- caption_visible=False
- ) %}
+
- {% call row() %}
- {{ text_field('Live')}}
- {% if current_service.trial_mode and not current_service.organisation %}
- {{ text_field('No (you need to assign this service to an organisation before you can make it live)') }}
- {{ text_field('') }}
- {% else %}
- {{ boolean_field(not current_service.trial_mode) }}
- {{ edit_field('Change', url_for('.service_switch_live', service_id=current_service.id)) }}
- {% endif %}
- {% endcall %}
+ Platform admin settings
- {% call row() %}
- {{ text_field('Count in list of live services')}}
- {{ text_field('Yes' if current_service.count_as_live else 'No') }}
- {{ edit_field('Change', url_for('.service_switch_count_as_live', service_id=current_service.id)) }}
- {% endcall %}
+ {% call mapping_table(
+ caption='Settings',
+ field_headings=['Label', 'Value', 'Action'],
+ field_headings_visible=False,
+ caption_visible=False
+ ) %}
- {% call row() %}
- {{ text_field('Organisation')}}
- {{ optional_text_field(current_service.organisation.name) }}
- {{ edit_field('Change', url_for('.link_service_to_organisation', service_id=current_service.id)) }}
- {% endcall %}
- {% call row() %}
- {{ text_field('Organisation type')}}
- {{ optional_text_field(
- (current_service.organisation_type or '')|title
- ) }}
- {{ edit_field('Change', url_for('.set_organisation_type', service_id=current_service.id)) }}
- {% endcall %}
- {% call row() %}
- {{ text_field('Free text message allowance')}}
- {{ text_field('{:,}'.format(current_service.free_sms_fragment_limit)) }}
- {{ edit_field('Change', url_for('.set_free_sms_allowance', service_id=current_service.id)) }}
- {% endcall %}
- {% call row() %}
- {{ text_field('Email branding' )}}
- {{ text_field(current_service.email_branding_name) }}
- {{ edit_field('Change', url_for('.service_set_email_branding', service_id=current_service.id)) }}
- {% endcall %}
- {% call row() %}
- {{ text_field('Letter branding')}}
- {{ optional_text_field(current_service.letter_branding.name) }}
- {{ edit_field('Change', url_for('.service_set_letter_branding', service_id=current_service.id)) }}
- {% endcall %}
- {% call row() %}
- {{ text_field('Data retention')}}
- {% call field() %}
- {{ current_service.data_retention | join(', ', attribute='notification_type') }}
+ {% call row() %}
+ {{ text_field('Live')}}
+ {% if current_service.trial_mode and not current_service.organisation %}
+ {{ text_field('No (you need to assign this service to an organisation before you can make it live)') }}
+ {{ text_field('') }}
+ {% else %}
+ {{ boolean_field(not current_service.trial_mode) }}
+ {{ edit_field('Change', url_for('.service_switch_live', service_id=current_service.id)) }}
+ {% endif %}
{% endcall %}
- {{ edit_field('Change', url_for('.data_retention', service_id=current_service.id)) }}
+
+ {% call row() %}
+ {{ text_field('Count in list of live services')}}
+ {{ text_field('Yes' if current_service.count_as_live else 'No') }}
+ {{ edit_field('Change', url_for('.service_switch_count_as_live', service_id=current_service.id)) }}
+ {% endcall %}
+
+ {% call row() %}
+ {{ text_field('Organisation')}}
+ {{ optional_text_field(current_service.organisation.name) }}
+ {{ edit_field('Change', url_for('.link_service_to_organisation', service_id=current_service.id)) }}
+ {% endcall %}
+ {% call row() %}
+ {{ text_field('Organisation type')}}
+ {{ optional_text_field(
+ (current_service.organisation_type or '')|title
+ ) }}
+ {{ edit_field('Change', url_for('.set_organisation_type', service_id=current_service.id)) }}
+ {% endcall %}
+ {% call row() %}
+ {{ text_field('Free text message allowance')}}
+ {{ text_field('{:,}'.format(current_service.free_sms_fragment_limit)) }}
+ {{ edit_field('Change', url_for('.set_free_sms_allowance', service_id=current_service.id)) }}
+ {% endcall %}
+ {% call row() %}
+ {{ text_field('Email branding' )}}
+ {{ text_field(current_service.email_branding_name) }}
+ {{ edit_field('Change', url_for('.service_set_email_branding', service_id=current_service.id)) }}
+ {% endcall %}
+ {% call row() %}
+ {{ text_field('Letter branding')}}
+ {{ optional_text_field(current_service.letter_branding.name) }}
+ {{ edit_field('Change', url_for('.service_set_letter_branding', service_id=current_service.id)) }}
+ {% endcall %}
+ {% call row() %}
+ {{ text_field('Data retention')}}
+ {% call field() %}
+ {{ current_service.data_retention | join(', ', attribute='notification_type') }}
+ {% endcall %}
+ {{ edit_field('Change', url_for('.data_retention', service_id=current_service.id)) }}
+ {% endcall %}
+
+ {% for permission in service_permissions %}
+ {% if not service_permissions[permission].requires or current_service.has_permission(service_permissions[permission].requires) %}
+ {% call row() %}
+ {{ text_field(service_permissions[permission].title)}}
+ {{ boolean_field(current_service.has_permission(permission)) }}
+ {{ edit_field('Change', url_for(service_permissions[permission].endpoint or '.service_set_permission', service_id=current_service.id, permission=permission if not service_permissions[permission].endpoint else None)) }}
+ {% endcall %}
+ {% endif %}
+ {% endfor %}
+
{% endcall %}
- {% for permission in service_permissions %}
- {% if not service_permissions[permission].requires or current_service.has_permission(service_permissions[permission].requires) %}
- {% call row() %}
- {{ text_field(service_permissions[permission].title)}}
- {{ boolean_field(current_service.has_permission(permission)) }}
- {{ edit_field('Change', url_for(service_permissions[permission].endpoint or '.service_set_permission', service_id=current_service.id, permission=permission if not service_permissions[permission].endpoint else None)) }}
- {% endcall %}
+
+ {% if current_service.active %}
+
+
+ {% else %}
+
+ Service suspended
+
+
{% endif %}
- {% endfor %}
-
- {% endcall %}
-
-
+
+
{% endif %}
diff --git a/tests/app/main/views/service_settings/test_service_setting_permissions.py b/tests/app/main/views/service_settings/test_service_setting_permissions.py
index 7f656e66a..ff3f327e9 100644
--- a/tests/app/main/views/service_settings/test_service_setting_permissions.py
+++ b/tests/app/main/views/service_settings/test_service_setting_permissions.py
@@ -92,16 +92,29 @@ def test_service_setting_toggles_show(get_service_settings_page, service_one, se
assert normalize_spaces(page.find('a', {'href': button_url}).find_parent('tr').text.strip()) == text
-@pytest.mark.parametrize('service_fields, endpoint, kwargs, text', [
- ({'active': True}, '.archive_service', {}, 'Archive service'),
- ({'active': True}, '.suspend_service', {}, 'Suspend service'),
- ({'active': False}, '.resume_service', {}, 'Resume service'),
+@pytest.mark.parametrize('service_fields, endpoint, index, text', [
+ ({'active': True}, '.archive_service', 0, 'Archive service'),
+ ({'active': True}, '.suspend_service', 1, 'Suspend service'),
+ ({'active': False}, '.resume_service', 0, 'Resume service'),
+ pytest.param(
+ {'active': False}, '.archive_service', 1, 'Resume service',
+ marks=pytest.mark.xfail(raises=IndexError)
+ )
])
-def test_service_setting_button_toggles(get_service_settings_page, service_one, service_fields, endpoint, kwargs, text):
- button_url = url_for(endpoint, **kwargs, service_id=service_one['id'])
+def test_service_setting_button_toggles(
+ get_service_settings_page,
+ service_one,
+ service_fields,
+ endpoint,
+ index,
+ text,
+):
+ button_url = url_for(endpoint, service_id=service_one['id'])
service_one.update(service_fields)
page = get_service_settings_page()
- assert normalize_spaces(page.find('a', {'class': 'button', 'href': button_url}).text.strip()) == text
+ link = page.select('.page-footer-delete-link a')[index]
+ assert normalize_spaces(link.text) == text
+ assert link['href'] == button_url
@pytest.mark.parametrize('permissions,permissions_text,visible', [
diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py
index 46418d742..fd9aa1268 100644
--- a/tests/app/main/views/test_dashboard.py
+++ b/tests/app/main/views/test_dashboard.py
@@ -569,7 +569,7 @@ def test_monthly_shows_letters_in_breakdown(
service_id=service_one['id']
)
- columns = page.select('.table-field-center-aligned .big-number-label')
+ columns = page.select('.table-field-left-aligned .big-number-label')
assert normalize_spaces(columns[0].text) == 'emails'
assert normalize_spaces(columns[1].text) == 'text messages'
diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py
index 3fa335965..a59d64f32 100644
--- a/tests/app/main/views/test_send.py
+++ b/tests/app/main/views/test_send.py
@@ -656,12 +656,12 @@ def test_upload_valid_csv_shows_preview_and_table(
for row_index, row in enumerate([
(
- ' 07700900001 | ',
- ' A | ',
+ ' 07700900001 | ',
+ ' A | ',
(
- ' '
+ ' | '
' '
@@ -669,12 +669,12 @@ def test_upload_valid_csv_shows_preview_and_table(
)
),
(
- ' | 07700900002 | ',
- ' B | ',
+ ' 07700900002 | ',
+ ' B | ',
(
- ' '
+ ' | '
' '
@@ -682,12 +682,12 @@ def test_upload_valid_csv_shows_preview_and_table(
)
),
(
- ' | 07700900003 | ',
- ' C | ',
+ ' 07700900003 | ',
+ ' C | ',
(
- ' '
+ ' | '
' '
| |