aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2020-07-16 10:53:19 +0100
committerPjotr Prins2020-07-16 10:53:19 +0100
commitf0dd283c31acfcc34b967b7a81167e0543d06364 (patch)
treed7dc4aeeba3d235c6469ecb4d24eb3ed4d7b1750
parent6b4503da47e77984d00dacf827ab69e2582a3902 (diff)
downloadbh20-seq-resource-f0dd283c31acfcc34b967b7a81167e0543d06364.tar.gz
bh20-seq-resource-f0dd283c31acfcc34b967b7a81167e0543d06364.tar.lz
bh20-seq-resource-f0dd283c31acfcc34b967b7a81167e0543d06364.zip
Add edit icon to text on github
Closes #76
-rw-r--r--bh20simplewebuploader/main.py13
-rw-r--r--bh20simplewebuploader/static/image/edit.pngbin0 -> 2452 bytes
-rw-r--r--bh20simplewebuploader/static/main.css14
-rw-r--r--bh20simplewebuploader/templates/blog.html4
4 files changed, 24 insertions, 7 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 8a6794e..0f521d0 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -444,8 +444,12 @@ def receive_files():
finally:
shutil.rmtree(dest_dir)
-def get_html_body(fn):
- buf = ""
+
+def edit_button(url,text="Edit text!"):
+ return '<p class="editbutton"><a href="'+url+'">'+text+'!<img src="static/image/edit.png"></a></p>'
+
+def get_html_body(fn,source="https://github.com/arvados/bh20-seq-resource/tree/master/doc"):
+ buf = edit_button(source)
in_body = False
begin_body = re.compile(r"<body>",re.IGNORECASE)
end_body = re.compile(r"(</body>|.*=\"postamble\")",re.IGNORECASE)
@@ -457,6 +461,7 @@ def get_html_body(fn):
buf += line
elif begin_body.match(line):
in_body = True
+ buf += edit_button(source)
return buf
@app.route('/download')
@@ -549,13 +554,13 @@ def blog_page():
blog_content = request.args.get('id') # e.g. using-covid-19-pubseq-part3
buf = None;
if blog_content:
- buf = get_html_body('doc/blog/'+blog_content+'.html')
+ buf = get_html_body('doc/blog/'+blog_content+'.html',"https://github.com/arvados/bh20-seq-resource/blob/master/doc/blog/"+blog_content+".org")
return render_template('blog.html',menu='BLOG',embed=buf,blog=blog_content)
@app.route('/about')
def about_page():
- buf = get_html_body('doc/web/about.html')
+ buf = get_html_body('doc/web/about.html','https://github.com/arvados/bh20-seq-resource/blob/master/doc/web/about.org')
return render_template('about.html',menu='ABOUT',embed=buf)
##
diff --git a/bh20simplewebuploader/static/image/edit.png b/bh20simplewebuploader/static/image/edit.png
new file mode 100644
index 0000000..571b08c
--- /dev/null
+++ b/bh20simplewebuploader/static/image/edit.png
Binary files differ
diff --git a/bh20simplewebuploader/static/main.css b/bh20simplewebuploader/static/main.css
index b9b27f4..47fb408 100644
--- a/bh20simplewebuploader/static/main.css
+++ b/bh20simplewebuploader/static/main.css
@@ -377,3 +377,17 @@ div.status {
vertical-align: top;
border-bottom: 1px solid #ddd;
}
+
+.editbutton {
+ float: right;
+ text-align: right;
+ background-color: lightgrey;
+ border: 2px solid #4CAF50;
+ border-radius: 12px;
+ color: black;
+ padding: 5px 32px;
+ // text-decoration: none;
+ display: inline-block;
+ font-size: 16px;
+ box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
+}
diff --git a/bh20simplewebuploader/templates/blog.html b/bh20simplewebuploader/templates/blog.html
index dbc0b99..823f8a1 100644
--- a/bh20simplewebuploader/templates/blog.html
+++ b/bh20simplewebuploader/templates/blog.html
@@ -9,9 +9,7 @@
{{ embed|safe }}
<hr>
- <p>
- Other blog entries:
- </p>
+ <h1>Other blog entries</h1>
{% else %}
{% include 'blurb.html' %}