From 86a6b4ff8e0f83e74c325a0603b153dd32193670 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 12 Mar 2024 13:41:05 -0700 Subject: [PATCH 1/3] marco to table --- app/templates/views/check/preview.html | 44 ++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/app/templates/views/check/preview.html b/app/templates/views/check/preview.html index 7398a7fd9..86b173677 100644 --- a/app/templates/views/check/preview.html +++ b/app/templates/views/check/preview.html @@ -42,7 +42,7 @@
- {% call(item, row_number) list_table( + + + + + + {% for header in recipients.column_headers %} + + {% endfor %} + + + + {% for item in recipients.displayed_rows %} + + {% for column in recipients.column_headers %} + + {% endfor %} + {% if item[None].data %} + {% for column in item[None].data %} + + {% endfor %} + {% endif %} + + {% endfor %} + +
+ Note: Only the first 5 rows are displayed here. +
+ {{ header }} +
+
+ {% if item[column].ignore %} + {{ item[column].data or '' }} + {% else %} + {{ item[column].data or '' }} + {% endif %} +
+
+
+ {{ column }} +
+
{% endif %} {% for column in recipients.column_headers %} {% endfor %} {% if item[None].data %} {% for column in item[None].data %} - + {% endfor %} {% endif %} diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 35309f57f..949852824 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -975,11 +975,11 @@ def test_upload_valid_csv_shows_preview_and_table( for row_index, row in enumerate( [ ( - '', - '', + '', + '', ( '', - '', + '', + '', ( '', - '', + '', + '', ( ' {% for item in recipients.displayed_rows %} - - {% for column in recipients.column_headers %} - - {% endfor %} - {% if item[None].data %} - {% for column in item[None].data %} - - {% endfor %} + {% if loop.index <= 5 %} + + {% for column in recipients.column_headers %} + + {% endfor %} + {% if item[None].data %} + {% for column in item[None].data %} + + {% endfor %} + {% endif %} + {% endif %} - {% endfor %}
Note: Only the first 5 rows are displayed here. @@ -79,22 +60,29 @@
-
- {% if item[column].ignore %} - {{ item[column].data or '' }} +
+ {% set column_data = item[column].data or '' %} + {% if column_data is iterable and column_data is not string %} +
    + {% for data_item in column_data %} + {% if data_item is not none %} +
  • {{ data_item }}
  • + {% endif %} + {% endfor %} +
{% else %} - {{ item[column].data or '' }} + {{ column_data }} {% endif %}
-
- {{ column }} -
-
+
+ {{ column }} +
+
2028675301
A
2028675301
A
' - '
' + '
' "
    " "
  • foo
  • foo
  • foo
  • " "
" @@ -988,11 +988,11 @@ def test_upload_valid_csv_shows_preview_and_table( ), ), ( - '
2028675302
B
2028675302
B
' - '
' + '
' "
    " "
  • foo
  • foo
  • foo
  • " "
" @@ -1001,11 +1001,11 @@ def test_upload_valid_csv_shows_preview_and_table( ), ), ( - '
2028675303
C
2028675303
C
' - '
' + '
' "
    " "
  • foo
  • foo
  • " "
" From bc71549d12e2e365a93ff32def092b6879672210 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Fri, 15 Mar 2024 10:33:39 -0700 Subject: [PATCH 3/3] added a conditional to limit only 5 rows to display --- app/templates/views/check/preview.html | 58 +++++++++++++------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/app/templates/views/check/preview.html b/app/templates/views/check/preview.html index ea7978ebe..ebf2ec8c2 100644 --- a/app/templates/views/check/preview.html +++ b/app/templates/views/check/preview.html @@ -57,35 +57,37 @@
-
- {% set column_data = item[column].data or '' %} - {% if column_data is iterable and column_data is not string %} -
    - {% for data_item in column_data %} - {% if data_item is not none %} -
  • {{ data_item }}
  • - {% endif %} - {% endfor %} -
- {% else %} - {{ column_data }} - {% endif %} -
-
-
- {{ column }} -
-
+
+ {% set column_data = item[column].data or '' %} + {% if column_data is iterable and column_data is not string %} +
    + {% for data_item in column_data %} + {% if data_item is not none %} +
  • {{ data_item }}
  • + {% endif %} + {% endfor %} +
+ {% else %} + {{ column_data }} + {% endif %} +
+
+
+ {{ column }} +
+