diff --git a/.eslintrc.json b/.eslintrc.json index a5bc36c2..15b7e14a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,6 +19,7 @@ "enableMapLocate": true, "featureGeometry": true, "fetchGeoJsonFeatureCollection": true, + "fetchPdf": true, "filterApplication": true, "filterReset": true, "getFeatureCenter": true, diff --git a/.gitignore b/.gitignore index c16bbe76..eee61ca1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ db.sqlite3 # Datenwerft.HRO datenwerft/secrets.py -datenmanagement/migrations hilfe/build /static /uploads diff --git a/datenmanagement/static/datenmanagement/js/list.js b/datenmanagement/static/datenmanagement/js/list.js index c491d303..e92b47b6 100644 --- a/datenmanagement/static/datenmanagement/js/list.js +++ b/datenmanagement/static/datenmanagement/js/list.js @@ -21,6 +21,34 @@ function formatData(data, brReplacement) { return data.trim(); // remove any remaining whitespaces from both sides } +/** + * @function + * @name fetchPdf + * + * fetches PDF file + * + * @param {string} url - URL + * @param {string} csrfToken - CSRF token + * @param {string} host - host + */ +function fetchPdf(url, csrfToken, host){ + const response = fetch( + url, { + method: 'POST', + headers: { + contentType: 'application/json', + 'X-CSRFToken': csrfToken + }, + redirect: 'follow', + origin: host, + referrerPolicy: 'no-referrer', + body: JSON.stringify(window.renderParams) + } + ); + response.then(response => response.blob()) + .then(myblob => window.open(URL.createObjectURL(myblob))); +} + /** * @function * @name initDataTable diff --git a/datenmanagement/templates/datenmanagement/list.html b/datenmanagement/templates/datenmanagement/list.html index c753f727..9ffcad95 100644 --- a/datenmanagement/templates/datenmanagement/list.html +++ b/datenmanagement/templates/datenmanagement/list.html @@ -75,6 +75,7 @@

window.dataUrl = '{{ url_model_tabledata }}'; {% endif %} window.languageUrl = '{% static 'datatables/datatables.german.lang' %}'; + window.checkAllTarget = true;