aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader
diff options
context:
space:
mode:
authorPjotr Prins2020-05-24 11:16:47 -0500
committerPjotr Prins2020-05-24 11:16:47 -0500
commite4738edf99cb96214db066079adae021c25bc059 (patch)
tree2215e5b668d86b08bde67259c976d14560f6f5f1 /bh20simplewebuploader
parentc3bbd48601cdb4bec510db72bd2296724874f4f3 (diff)
downloadbh20-seq-resource-e4738edf99cb96214db066079adae021c25bc059.tar.gz
bh20-seq-resource-e4738edf99cb96214db066079adae021c25bc059.tar.lz
bh20-seq-resource-e4738edf99cb96214db066079adae021c25bc059.zip
Download page
Diffstat (limited to 'bh20simplewebuploader')
-rw-r--r--bh20simplewebuploader/main.py32
-rw-r--r--bh20simplewebuploader/templates/download.html30
-rw-r--r--bh20simplewebuploader/templates/menu.html1
-rw-r--r--bh20simplewebuploader/templates/org-header.html1
4 files changed, 52 insertions, 12 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index eb9a0f5..f7e45fb 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -417,22 +417,12 @@ def receive_files():
finally:
shutil.rmtree(dest_dir)
-
-@app.route('/demo')
-def demo_page():
- return render_template('demo.html',menu='DEMO')
-
-@app.route('/blog')
-def blog_page():
- return render_template('blog.html',menu='BLOG')
-
-@app.route('/about')
-def about_page():
+def get_html_body(fn):
buf = ""
in_body = False
begin_body = re.compile(r"<body>",re.IGNORECASE)
end_body = re.compile(r"(</body>|.*=\"postamble\")",re.IGNORECASE)
- with open('doc/web/about.html') as f:
+ with open(fn) as f:
for line in f:
if end_body.match(line):
break
@@ -440,6 +430,24 @@ def about_page():
buf += line
elif begin_body.match(line):
in_body = True
+ return buf
+
+@app.route('/download')
+def download_page():
+ buf = get_html_body('doc/web/download.html')
+ return render_template('about.html',menu='DOWNLOAD',embed=buf)
+
+@app.route('/demo')
+def demo_page():
+ return render_template('demo.html',menu='DEMO')
+
+@app.route('/blog')
+def blog_page():
+ return render_template('blog.html',menu='BLOG')
+
+@app.route('/about')
+def about_page():
+ buf = get_html_body('doc/web/about.html')
return render_template('about.html',menu='ABOUT',embed=buf)
## Dynamic API functions starting here
diff --git a/bh20simplewebuploader/templates/download.html b/bh20simplewebuploader/templates/download.html
new file mode 100644
index 0000000..07b6951
--- /dev/null
+++ b/bh20simplewebuploader/templates/download.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ {% include 'org-header.html' %}
+ <body>
+ {% include 'banner.html' %}
+ {% include 'menu.html' %}
+
+ {{ embed|safe }}
+
+ {% include 'footer.html' %}
+
+ <script type="text/javascript">
+ let scriptRoot = {{ request.script_root|tojson|safe }}; // examples
+
+ document.addEventListener("DOMContentLoaded", function(){
+ var count = fetch("/api/getCount")
+ .then((resp) => resp.json())
+ .then(function (data) {
+ count = data["sequences"];
+ console.log(count);
+ span = document.getElementById("Counter");
+ txt = document.createTextNode(count);
+ span.appendChild(txt);
+ });
+ });
+
+ </script>
+ </body>
+
+</html>
diff --git a/bh20simplewebuploader/templates/menu.html b/bh20simplewebuploader/templates/menu.html
index 55bb1c4..6f97e19 100644
--- a/bh20simplewebuploader/templates/menu.html
+++ b/bh20simplewebuploader/templates/menu.html
@@ -1,6 +1,7 @@
<section class="menu">
<div class="topnav" id="myTopnav">
<a href="/" class="{{ 'active' if menu=='HOME' }}">COVID-19</a>
+ <a href="/download" class="{{ 'active' if menu=='DOWNLOAD' }}">DOWNLOAD</a>
<a href="/demo" class="{{ 'active' if menu=='DEMO' }}">DEMO</a>
<a href="/blog" class="{{ 'active' if menu=='BLOG' }}">BLOG</a>
<a href="/about" class="{{ 'active' if menu=='ABOUT' }}">ABOUT</a>
diff --git a/bh20simplewebuploader/templates/org-header.html b/bh20simplewebuploader/templates/org-header.html
index 915bcb7..fdf9e14 100644
--- a/bh20simplewebuploader/templates/org-header.html
+++ b/bh20simplewebuploader/templates/org-header.html
@@ -30,6 +30,7 @@
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
+ p { margin: 10px; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;