Convert comment posting system to flask framework
This commit is contained in:
@@ -45,3 +45,26 @@
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro comment_posting_box(info) %}
|
||||
<form action="{{ info['form_action'] }}" method="post" class="comment-form">
|
||||
<div id="comment-account-options">
|
||||
<label for="account-selection">Account:</label>
|
||||
<select id="account-selection" name="channel_id">
|
||||
{% for account in info['accounts'] %}
|
||||
<option value="{{ account[0] }}">{{ account[1] }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<a href="/https://youtube.com/login" target="_blank">Add account</a>
|
||||
</div>
|
||||
<textarea name="comment_text"></textarea>
|
||||
{% if info['include_video_id_input'] %}
|
||||
<input type="hidden" name="video_id" value="{{ info['video_id'] }}">
|
||||
{% endif %}
|
||||
<button type="submit" class="post-comment-button">{{ 'Post reply' if info['replying'] else 'Post comment' }}</button>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -42,23 +42,7 @@
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<form action="{{ form_action }}" method="post" class="comment-form">
|
||||
<div id="comment-account-options">
|
||||
<label for="account-selection">Account:</label>
|
||||
<select id="account-selection" name="channel_id">
|
||||
{% for account in accounts %}
|
||||
<option value="{{ account[0] }}">{{ account[1] }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<a href="/https://youtube.com/login" target="_blank">Add account</a>
|
||||
</div>
|
||||
<textarea name="comment_text"></textarea>
|
||||
{% if include_video_id_input %}
|
||||
<input type="hidden" name="video_id" value="{{ comments_info['video_id'] }}">
|
||||
{% endif %}
|
||||
<button type="submit" class="post-comment-button">{{ 'Post reply' if comments_info['is_replies'] else 'Post comment' }}</button>
|
||||
</form>
|
||||
{{ comments.comment_posting_box(comment_posting_box_info) }}
|
||||
|
||||
{% if not comments_info['is_replies'] %}
|
||||
<div class="comment-links">
|
||||
|
||||
26
youtube/templates/delete_comment.html
Normal file
26
youtube/templates/delete_comment.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block page_title %}Delete comment?{% endblock %}
|
||||
|
||||
{% block style %}
|
||||
main{
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0px, 3fr) 640px 40px 500px minmax(0px,2fr);
|
||||
align-content: start;
|
||||
}
|
||||
main > div, main > form{
|
||||
margin-top:20px;
|
||||
grid-column:2;
|
||||
}
|
||||
{% endblock style %}
|
||||
|
||||
{% block main %}
|
||||
<div>Are you sure you want to delete this comment?</div>
|
||||
<form action="" method="POST">
|
||||
{% for parameter_name, parameter_value in parameters %}
|
||||
<input type="hidden" name="{{ parameter_name }}" value="{{ parameter_value }}">
|
||||
{% endfor %}
|
||||
<input type="submit" value="Yes, delete it">
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
30
youtube/templates/post_comment.html
Normal file
30
youtube/templates/post_comment.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "comments.html" as comments %}
|
||||
|
||||
{% block page_title %}{{ 'Post reply' if replying else 'Post comment' }}{% endblock %}
|
||||
|
||||
{% block style %}
|
||||
main{
|
||||
display: grid;
|
||||
grid-template-columns: 3fr 2fr;
|
||||
}
|
||||
.left{
|
||||
display:grid;
|
||||
grid-template-columns: 1fr 640px;
|
||||
}
|
||||
textarea{
|
||||
width: 460px;
|
||||
height: 85px;
|
||||
}
|
||||
.comment-form{
|
||||
grid-column:2;
|
||||
justify-content:start;
|
||||
}
|
||||
{% endblock style %}
|
||||
|
||||
{% block main %}
|
||||
<div class="left">
|
||||
{{ comments.comment_posting_box(comment_posting_box_info) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user