diff --git a/cycledash/static/css/runs.css b/cycledash/static/css/runs.css index 993fa74..ccc447c 100644 --- a/cycledash/static/css/runs.css +++ b/cycledash/static/css/runs.css @@ -11,6 +11,14 @@ form#submit { #show-submit { float: right; } + +/* Last comments list: */ +a.all-comments { + font-size: 14px; + color: #adadad; +} + +/* Runs table: */ .runs.table { margin-top: 23px; } diff --git a/cycledash/static/css/style.css b/cycledash/static/css/style.css index 4ad0601..44fc895 100644 --- a/cycledash/static/css/style.css +++ b/cycledash/static/css/style.css @@ -10,3 +10,29 @@ section { margin: auto; } img.cycle { float: right; } + +.comments { + list-style: none; +} +.comments .run-id { + font-weight: bold; +} +.comments .run-id a { + color: black; +} +.comments .location { + padding-left: 7px; +} +.comments .summary { + padding-left: 20px; +} +.comments .summary:before { + content: '“'; + font-size: 19px; + padding-right: 5px; +} +.comments .summary:after { + content: '”'; + font-size: 19px; + padding-left: 5px; +} diff --git a/cycledash/templates/comments.html b/cycledash/templates/comments.html new file mode 100644 index 0000000..ec610e1 --- /dev/null +++ b/cycledash/templates/comments.html @@ -0,0 +1,13 @@ +{% extends "layouts/layout.html" %} +{%- from 'macros/nav.html' import nav -%} +{%- from 'macros/comments.html' import comment_list -%} + +{% block body %} +{{ nav("runs") }} +
+
+

All Comments

+ {{ comment_list(comments) }} +
+
+{% endblock %} diff --git a/cycledash/templates/macros/comments.html b/cycledash/templates/macros/comments.html new file mode 100644 index 0000000..15fae1a --- /dev/null +++ b/cycledash/templates/macros/comments.html @@ -0,0 +1,13 @@ +{% macro comment_list(comments) -%} + +{%- endmacro %} diff --git a/cycledash/templates/macros/run_form.html b/cycledash/templates/macros/run_form.html new file mode 100644 index 0000000..123cf8f --- /dev/null +++ b/cycledash/templates/macros/run_form.html @@ -0,0 +1,44 @@ +{% macro run_form() -%} +
+

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+

Optional all paths should be HDFS paths to canonical data

+
+ + +
+
+ + +
+
+ + +
+ + +
+{%- endmacro -%} diff --git a/cycledash/templates/runs.html b/cycledash/templates/runs.html index 503c455..ebe116e 100644 --- a/cycledash/templates/runs.html +++ b/cycledash/templates/runs.html @@ -1,5 +1,7 @@ {% extends "layouts/layout.html" %} {%- from 'macros/nav.html' import nav -%} +{%- from 'macros/run_form.html' import run_form -%} +{%- from 'macros/comments.html' import comment_list -%} {% block head %} @@ -9,48 +11,12 @@ {{ nav("runs") }}

Runs Directory

-
-

-
- - -
-
- - -
-
- - -
-
- - -
-
-

Optional all paths should be HDFS paths to canonical data

-
- - -
-
- - -
-
- - -
+ {{ run_form() }} - -
+ {% if last_comments -%} +

Last {{ last_comments|length}} Comments: (see all)

+ {{ comment_list(last_comments) }} + {%- endif %} diff --git a/cycledash/views.py b/cycledash/views.py index e78dc14..a8794f7 100644 --- a/cycledash/views.py +++ b/cycledash/views.py @@ -65,8 +65,13 @@ def runs(): q = select(vcfs.c + [num_comments]).select_from(joined).group_by( vcfs.c.id).order_by(desc(vcfs.c.id)) vcfs = [dict(v) for v in con.execute(q).fetchall()] + + q = select(user_comments.c).order_by( + desc(user_comments.c.last_modified)).limit(5) + last_comments = [dict(c) for c in con.execute(q).fetchall()] if 'text/html' in request.accept_mimetypes: - return render_template('runs.html', runs=vcfs, run_kvs=RUN_ADDL_KVS) + return render_template('runs.html', runs=vcfs, run_kvs=RUN_ADDL_KVS, + last_comments=last_comments) elif 'application/json' in request.accept_mimetypes: return jsonify({'runs': vcfs}) @@ -92,6 +97,14 @@ def download_vcf(run_id): return send_file(fd, as_attachment=True, attachment_filename=filename) +@app.route('/comments') +def all_comments(): + with tables(db, 'user_comments') as (con, user_comments): + q = select(user_comments.c).order_by( + desc(user_comments.c.last_modified)) + comments = [dict(c) for c in con.execute(q).fetchall()] + return render_template('comments.html', comments=comments) + @app.route('/runs//comments', methods=['GET', 'POST']) def comments(vcf_id): if request.method == 'POST':