From f0dd283c31acfcc34b967b7a81167e0543d06364 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 16 Jul 2020 10:53:19 +0100 Subject: Add edit icon to text on github Closes #76 --- bh20simplewebuploader/main.py | 13 +++++++++---- bh20simplewebuploader/static/image/edit.png | Bin 0 -> 2452 bytes bh20simplewebuploader/static/main.css | 14 ++++++++++++++ bh20simplewebuploader/templates/blog.html | 4 +--- 4 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 bh20simplewebuploader/static/image/edit.png 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 '
' + +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"",re.IGNORECASE) end_body = re.compile(r"(|.*=\"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 Binary files /dev/null and b/bh20simplewebuploader/static/image/edit.png 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 }}- Other blog entries: -
+