From 36c7c277b2b9e508976b91129de05d6659986471 Mon Sep 17 00:00:00 2001 From: Doug Le Tough Date: Sat, 2 Dec 2017 20:50:42 +0100 Subject: [PATCH] "Is there something new ?" --- tetawebapp/static/styles/tetawebapp.css | 6 +++ tetawebapp/templates/ajax.html | 50 ++++++++++++++----------- tetawebapp/templates/index.html | 2 +- tetawebapp/templates/inputs.html | 6 ++- tetawebapp/tetawebapp.py | 6 +-- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/tetawebapp/static/styles/tetawebapp.css b/tetawebapp/static/styles/tetawebapp.css index fca02ad..2f57c9b 100644 --- a/tetawebapp/static/styles/tetawebapp.css +++ b/tetawebapp/static/styles/tetawebapp.css @@ -155,6 +155,12 @@ main > article > ol { text-justify: distribute; } +main > hr { + border-color: var(--mid-bg); + border-style: solid; + border-width: 1px; +} + main > article > img { display:inline-block; border-color: var(--mid-bg); diff --git a/tetawebapp/templates/ajax.html b/tetawebapp/templates/ajax.html index 8bb03be..99d9fc1 100644 --- a/tetawebapp/templates/ajax.html +++ b/tetawebapp/templates/ajax.html @@ -1,14 +1,35 @@ {% extends "index.html" %} {% block title %}Ajax{% endblock %} {% block main %} -
-

Get HTML response from AJAX

-

Click the refresh button to get the HTML response.

-

The response may randomly be a voluntary error so you should try it more than once.

- Refresh: -
-
-
+
+
+

Get HTML response from AJAX

+

Click the refresh button to get the HTML response.

+

The response may randomly be a voluntary error so you should try it more than once.

+ Refresh: +
+
+

Upload files with AJAX

+

Select files to upload

+

The response may randomly be a voluntary error so you should try it more than once.

+ Upload files: +
+ + + +
+
+
+
+
+

Set value via AJAX

@@ -25,17 +46,4 @@
-
-

Upload files with AJAX

-

Select files to upload

-

The response may randomly be a voluntary error so you should try it more than once.

- Upload files: -
- - - -
-
{% endblock %} diff --git a/tetawebapp/templates/index.html b/tetawebapp/templates/index.html index b0ab984..ece493a 100644 --- a/tetawebapp/templates/index.html +++ b/tetawebapp/templates/index.html @@ -8,7 +8,7 @@ - + {% block bodyheader %} diff --git a/tetawebapp/templates/inputs.html b/tetawebapp/templates/inputs.html index cb9a8c8..66cedb1 100644 --- a/tetawebapp/templates/inputs.html +++ b/tetawebapp/templates/inputs.html @@ -33,7 +33,11 @@ -->
- +

diff --git a/tetawebapp/tetawebapp.py b/tetawebapp/tetawebapp.py
index 4b24874..460e4a1 100755
--- a/tetawebapp/tetawebapp.py
+++ b/tetawebapp/tetawebapp.py
@@ -253,8 +253,8 @@ def set_value_from_ajax(value):
 @app.route("/upload", methods=['POST'])
 @check_session
 def upload():
-  """ Accept a value from an AJAX request
-      It may return an error code for testing purpose """
+  """ Save a file from AJAX request
+      Files are saved in UPLOADED_FILES_DEST (see config.local.py) """
   err_code = 'TETA_ERR'
   RND = int(random.random()*10)
   if RND % 2:
@@ -267,7 +267,7 @@ def upload():
   print "Uploaded files:"
   for f in uploaded_files:
     print '  [+] %s [%s]' % (f.filename, f.content_type)
-    # Befor saving you should:
+    # Before saving you should:
     # - Secure the filename
     # - Check file size
     # - Check content type