From 5673889a55e6b11f73ef968010d7f0dab4beac9e Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Fri, 10 May 2024 07:21:31 -0400 Subject: [PATCH] updated templates with css --- src/registrar/assets/sass/_theme/_admin.scss | 4 + .../templates/admin/import_export/import.html | 191 ++++++++++++++++++ .../import_export/resource_fields_list.html | 21 ++ 3 files changed, 216 insertions(+) create mode 100644 src/registrar/templates/admin/import_export/import.html create mode 100644 src/registrar/templates/admin/import_export/resource_fields_list.html diff --git a/src/registrar/assets/sass/_theme/_admin.scss b/src/registrar/assets/sass/_theme/_admin.scss index 9f5ea7a97..c716ad49c 100644 --- a/src/registrar/assets/sass/_theme/_admin.scss +++ b/src/registrar/assets/sass/_theme/_admin.scss @@ -717,6 +717,10 @@ div.dja__model-description{ } +.import_export_text { + color: var(--secondary); +} + .text-underline { text-decoration: underline !important; } diff --git a/src/registrar/templates/admin/import_export/import.html b/src/registrar/templates/admin/import_export/import.html new file mode 100644 index 000000000..ef1160a2d --- /dev/null +++ b/src/registrar/templates/admin/import_export/import.html @@ -0,0 +1,191 @@ +{% extends "admin/import_export/base.html" %} +{% load i18n %} +{% load admin_urls %} +{% load import_export_tags %} +{% load static %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block extrahead %}{{ block.super }} + + {% if confirm_form %} + {{ confirm_form.media }} + {% else %} + {{ form.media }} + {% endif %} +{% endblock %} + +{% block breadcrumbs_last %} +{% trans "Import" %} +{% endblock %} + +{% block content %} + + {% if confirm_form %} + {% block confirm_import_form %} +
+ {% csrf_token %} + {{ confirm_form.as_p }} +

+ {% trans "Below is a preview of data to be imported. If you are satisfied with the results, click 'Confirm import'" %} +

+
+ +
+
+ {% endblock %} + {% else %} + {% block import_form %} +
+ {% csrf_token %} + + {% include "admin/import_export/resource_fields_list.html" with import_or_export="import" %} + {% block import_form_additional_info %}{% endblock %} + + {% block form_detail %} +
+ {% for field in form %} +
+ {{ field.errors }} + + {{ field.label_tag }} + + {{ field }} + + {% if field.field.help_text %} +

{{ field.field.help_text|safe }}

+ {% endif %} +
+ {% endfor %} +
+ {% endblock %} + + {% block form_submit_button %} +
+ +
+ {% endblock %} +
+ {% endblock %} + {% endif %} + + {% if result %} + + {% if result.has_errors %} + {% block errors %} +

{% trans "Errors" %}

+ + {% endblock %} + + {% elif result.has_validation_errors %} + + {% block validation_errors %} +

{% trans "Some rows failed to validate" %}

+ +

{% trans "Please correct these errors in your data where possible, then reupload it using the form above." %}

+ + + + + + + {% for field in result.diff_headers %} + + {% endfor %} + + + + {% for row in result.invalid_rows %} + + + + {% for field in row.values %} + + {% endfor %} + + {% endfor %} + +
{% trans "Row" %}{% trans "Errors" %}{{ field }}
{{ row.number }} + {{ row.error_count }} +
+
    + {% for field_name, error_list in row.field_specific_errors.items %} +
  • + {{ field_name }} +
      + {% for error in error_list %} +
    • {{ error }}
    • + {% endfor %} +
    +
  • + {% endfor %} + {% if row.non_field_specific_errors %} +
  • + {% trans "Non field specific" %} +
      + {% for error in row.non_field_specific_errors %} +
    • {{ error }}
    • + {% endfor %} +
    +
  • + {% endif %} +
+
+
{{ field }}
+ {% endblock %} + + {% else %} + + {% block preview %} +

{% trans "Preview" %}

+ + + + + + {% for field in result.diff_headers %} + + {% endfor %} + + + {% for row in result.valid_rows %} + + + {% for field in row.diff %} + + {% endfor %} + + {% endfor %} +
{{ field }}
+ {% if row.import_type == 'new' %} + {% trans "New" %} + {% elif row.import_type == 'skip' %} + {% trans "Skipped" %} + {% elif row.import_type == 'delete' %} + {% trans "Delete" %} + {% elif row.import_type == 'update' %} + {% trans "Update" %} + {% endif %} + {{ field }}
+ {% endblock %} + + {% endif %} + + {% endif %} +{% endblock %} diff --git a/src/registrar/templates/admin/import_export/resource_fields_list.html b/src/registrar/templates/admin/import_export/resource_fields_list.html new file mode 100644 index 000000000..3f5483ea7 --- /dev/null +++ b/src/registrar/templates/admin/import_export/resource_fields_list.html @@ -0,0 +1,21 @@ +{% load i18n %} +{% block fields_help %} +

+ {% if import_or_export == "export" %} + {% trans "This exporter will export the following fields: " %} + {% elif import_or_export == "import" %} + {% trans "This importer will import the following fields: " %} + {% endif %} + + {% if fields_list|length <= 1 %} + {{ fields_list.0.1|join:", " }} + {% else %} +

+ {% for resource, fields in fields_list %} +
{{ resource }}
+
{{ fields|join:", " }}
+ {% endfor %} +
+ {% endif %} +

+{% endblock %} \ No newline at end of file