mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-01 12:47:32 -04:00
Truncate contact link text on settings page
The contact link on the settings page should be truncated instead of the text being wrapped and overflowing on to multiple lines. This adds in an option to the text_field macro to truncate long text fields. This setting has been used to truncate the API callback URLs too on the services/<service_id>/api/callbacks page.
This commit is contained in:
@@ -265,3 +265,9 @@ a.table-show-more-link {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.truncate-text {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
</td>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro text_field(text, status='') -%}
|
||||
{% macro text_field(text, status='', truncate=false) -%}
|
||||
{% call field(status=status) %}
|
||||
{% if text is iterable and text is not string %}
|
||||
<ul class="list list-bullet">
|
||||
@@ -89,15 +89,20 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
{{ text }}
|
||||
{% if truncate %}
|
||||
<div class="truncate-text" title="{{ text }}">{{text}}</div>
|
||||
{% else %}
|
||||
{{ text }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro optional_text_field(text, default='Not set') -%}
|
||||
{% macro optional_text_field(text, default='Not set', truncate=false) -%}
|
||||
{{ text_field(
|
||||
text or default,
|
||||
status='' if text else 'default'
|
||||
status='' if text else 'default',
|
||||
truncate=truncate
|
||||
) }}
|
||||
{%- endmacro %}
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
) %}
|
||||
{% call row() %}
|
||||
{{ text_field('Callbacks for delivery receipts') }}
|
||||
{{ optional_text_field(delivery_status_callback) }}
|
||||
{{ optional_text_field(delivery_status_callback, truncate=true) }}
|
||||
{{ edit_field('Change', url_for('.delivery_status_callback', service_id=current_service.id)) }}
|
||||
{% endcall %}
|
||||
|
||||
{% call row() %}
|
||||
{{ text_field('Callbacks for received text messages') }}
|
||||
{{ optional_text_field(received_text_messages_callback) }}
|
||||
{{ optional_text_field(received_text_messages_callback, truncate=true) }}
|
||||
{{ edit_field('Change', url_for('.received_text_messages_callback', service_id=current_service.id)) }}
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
{% if 'upload_document' in current_service.permissions %}
|
||||
{% call row() %}
|
||||
{{ text_field('Contact link') }}
|
||||
{{ text_field(current_service.contact_link) }}
|
||||
{{ text_field(current_service.contact_link, truncate=true) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.service_set_contact_link',
|
||||
|
||||
Reference in New Issue
Block a user