tatus 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. diff --git a/flask_app/app/main/routes.py b/flask_app/app/main/routes.py
  2. index c36c90c..9e38594 100644
  3. --- a/flask_app/app/main/routes.py
  4. +++ b/flask_app/app/main/routes.py
  5. @@ -311,7 +311,10 @@ def download_upload(i_upload:int = 0, bl_download:bool = True):
  6. o_out = io.BytesIO(o_upload.b_file)
  7. s_mimetype = o_upload.v_mime_type
  8. s_filename = o_upload.v_filename
  9. - resp = send_file(o_out, mimetype=s_mimetype, as_attachment=bl_download, download_name=s_filename)
  10. + # resp = send_file(o_out, mimetype=s_mimetype, as_attachment=bl_download, download_name=s_filename)
  11. + resp = make_response(o_out)
  12. + resp.headers.set("Content-Disposition", f"attachment; filename=\"{s_filename}\"" if bl_download else "inline")
  13. + resp.headers.set("Content-Type", s_mimetype)
  14. return resp
  15. else:
  16. return make_response("No upload retrieved", 500)
  17. @@ -776,6 +779,14 @@ def user_details(i_user_id:int = 0):
  18. # end of user_details view function for route /user_details/<int:i_user_id>/
  19. 
  20. 
  21. +@bp.route("/css_sample", methods=["GET"])
  22. +def css_sample():
  23. + """CSS sample page - purely testing"""
  24. + s_base = "base_bs.html" if Config.BOOTSTRAP else "base.html"
  25. + s_url = url_for("main.index")#, _external=True)
  26. + return render_template("css_sample.html", js=True, base=s_base, url=s_url)
  27. +# end of css_sample view function for route /css_sample
  28. +
  29. 
  30. s_todo = """
  31. double-check both try-except across the board, along with then logging exceptions
  32. diff --git a/flask_app/app/templates/index.html b/flask_app/app/templates/index.html
  33. index 211713f..68aa33e 100644
  34. --- a/flask_app/app/templates/index.html
  35. +++ b/flask_app/app/templates/index.html
  36. @@ -296,8 +296,9 @@ try {
  37. $.each(o_data.uploads, function(ix, u) {
  38. s_html = s_html + "<li><ul>";
  39. s_html = s_html + "<li><span class=\"label\">Document Type:</span>&nbsp;" + String(u.si_upload_type) + "</li>\n";
  40. - s_url = "{{ url_for("main.download_upload", i_upload=99999, bl_download=True) }}".replace("99999", String(u["id"]));
  41. - s_html = s_html + "<li><span class=\"label\">File Name:</span>&nbsp;<a href=\"" + s_url + "\" target=\"_blank\">" + String(u["v_filename"]) + "</a></li>\n";
  42. + s_url_download = "{{ url_for("main.download_upload", i_upload=99999, bl_download=True) }}".replace("99999", String(u["id"]));
  43. + s_url_view = "{{ url_for("main.download_upload", i_upload=99999, bl_download=False) }}".replace("99999", String(u["id"]));
  44. + s_html = s_html + "<li><span class=\"label\">File Name:</span>&nbsp;<a href=\"" + s_url_download + "\" target=\"_blank\"> download - " + String(u["v_filename"]) + "</a>&nbsp;<a href=\"" + s_url_view + "\" target=\"_blank\"> view - " + String(u["v_filename"]) + "</a></li>\n";
  45. s_html = s_html + "<li><span class=\"label\">Description:</span>&nbsp;" + String(u["v_description"]) + "</li>\n";
  46. if (String(u["v_qualification_name"])!="null") { s_html = s_html + "<li><span class=\"label\">Matching Qualification:</span>&nbsp;" + String(u["v_qualification_name"]) + "</li>\n"; }
  47. s_html = s_html + "</ul></li>\n";