diff --git a/lib/importer/templates/previews/upload.html b/lib/importer/templates/previews/upload.html new file mode 100644 index 00000000..3ca24bd9 --- /dev/null +++ b/lib/importer/templates/previews/upload.html @@ -0,0 +1,24 @@ +{% from "govuk/components/button/macro.njk" import govukButton %} +{% from "govuk/components/file-upload/macro.njk" import govukFileUpload %} + +{% macro show() %} +
+

Upload your data

+ +
+
+ {{ govukFileUpload({ + id: "file-upload", + name: "file", + label: { text: "Upload an XLSX, ODS, or CSV file"}, + attributes: { "accept": + ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.csv,text/csv,application/vnd.oasis.opendocument.spreadsheet,.ods"}, + errorMessage: false }) + }} +
+
+ {{ govukButton({ text: "Upload" }) }} +
+
+
+{% endmacro %} diff --git a/lib/importer/templates/upload.html b/lib/importer/templates/upload.html index b442b36c..c981602e 100644 --- a/lib/importer/templates/upload.html +++ b/lib/importer/templates/upload.html @@ -4,31 +4,36 @@ {% block pageTitle %} {{ serviceName }} – GOV.UK Prototype Kit {% endblock %} {% block beforeContent %} -{{ govukBackLink({ text: "Back", href: "javascript:window.history.back()" }) }} + {{ govukBackLink({ text: "Back", href: "javascript:window.history.back()" }) }} {% endblock %} {% block content %}
-
-

Upload your data

+ {% if importerUploadPath %} +
+

Upload your data

-
-
- {{ govukFileUpload({ - id: "file-upload", - name: "file", - label: { text: "Upload an XLSX, ODS, or CSV file"}, - attributes: { "accept": ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.csv,text/csv,application/vnd.oasis.opendocument.spreadsheet,.ods"}, - errorMessage: importerError(data) - }) - }} -
-
- {{ govukButton({ text: "Upload" }) }} -
-
-
+
+
+ {{ + govukFileUpload({ + id: "file-upload", + name: "file", + label: { text: "Upload an XLSX, ODS, or CSV file"}, + attributes: { "accept": + ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.csv,text/csv,application/vnd.oasis.opendocument.spreadsheet,.ods"}, + errorMessage: importerError(data) + }) + }} +
+
+ {{ govukButton({ text: "Upload" }) }} +
+
+
+ {% else %} + {% import "./previews/upload.html" as preview %} + {{ preview.show() }} + {% endif %}
- - {% endblock %}