From 8cad77ad0d7e0a0d07629087e2ee1709688cb58d Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 19 Jul 2019 22:27:10 -0700 Subject: Convert comments to flask framework --- youtube/templates/comments.html | 47 ++++++++++++++++++++ youtube/templates/comments_page.html | 83 ++++++++++++++++++++++++++++++++++++ youtube/templates/watch.html | 6 ++- 3 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 youtube/templates/comments.html create mode 100644 youtube/templates/comments_page.html (limited to 'youtube/templates') diff --git a/youtube/templates/comments.html b/youtube/templates/comments.html new file mode 100644 index 0000000..901190f --- /dev/null +++ b/youtube/templates/comments.html @@ -0,0 +1,47 @@ +{% import "common_elements.html" as common_elements %} + +{% macro render_comment(comment, include_avatar) %} +
+
+ + {% if include_avatar %} + + {% endif %} + +
+ {{ comment['author'] }} +
+ + {{ common_elements.text_runs(comment['text']) }} + + +
+ {{ comment['view_replies_text'] }} + {% if 'delete_url' is in comment %} + Delete + {% endif %} +
+
+ +
+{% endmacro %} + +{% macro video_comments(comments_info) %} +
+ +
+ {% for comment in comments_info['comments'] %} + {{ render_comment(comment, comments_info['include_avatars']) }} + {% endfor %} +
+ {% if 'more_comments_url' is in comments_info %} + More comments + {% endif %} +
+{% endmacro %} diff --git a/youtube/templates/comments_page.html b/youtube/templates/comments_page.html new file mode 100644 index 0000000..a77d2b4 --- /dev/null +++ b/youtube/templates/comments_page.html @@ -0,0 +1,83 @@ +{% extends "base.html" %} +{% import "comments.html" as comments %} + +{% block page_title %}{{ 'Replies' if comments_info['is_replies'] else 'Comments page ' + comments_info['page_number'] }}{% endblock %} + + +{% block style %} + main{ + display:grid; + grid-template-columns: 3fr 2fr; + } + #left{ + background-color:#bcbcbc; + + display: grid; + grid-column: 1; + grid-row: 1; + grid-template-columns: 1fr 640px; + grid-template-rows: 0fr 0fr 0fr; + } + .comments-area{ + grid-column:2; + } + .comment{ + width:640px; + } +{% endblock style %} + + +{% block main %} +
+
+ {% if not comments_info['is_replies'] %} + + {% endif %} + + +
+
+ + + Add account +
+ + {% if include_video_id_input %} + + {% endif %} + +
+ + {% if not comments_info['is_replies'] %} + + {% endif %} + +
+ {% for comment in comments_info['comments'] %} + {{ comments.render_comment(comment, comments_info['include_avatars']) }} + {% endfor %} +
+ {% if 'more_comments_url' is in comments_info %} + More comments + {% endif %} +
+
+{% endblock main %} + + diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 85c87ae..d61997f 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% import "common_elements.html" as common_elements %} +{% import "comments.html" as comments %} {% block page_title %}{{ title }}{% endblock %} {% block style %} main{ @@ -211,7 +212,10 @@ {% endif %} -{{ comments|safe }} + + {% if comments_info %} + {{ comments.video_comments(comments_info) }} + {% endif %} -- cgit v1.2.3