Template of comments

Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
Valentin Popov 2018-09-30 07:26:49 +04:00
parent 75605da179
commit bdaafc3d36
Signed by: Valentin Popov
GPG Key ID: 269A00ACA90A8EA3

38
_includes/comments.html Normal file
View File

@ -0,0 +1,38 @@
{% raw %}
<script type="text/html" id="template">
<div class="panel panel-default">
<!-- Title -->
<div class="panel-heading">
<img class="github-avatar img-rounded" src="{{= it.avatar }}">
<a href="{{= it.url }}"><strong>{{= it.user }}</strong></a>
<span>commented on {{= it.date }}</span>
</div>
<!-- Content -->
<div class="panel-body">{{= it.content }}</div>
</div>
</script>
{% endraw %}
<h2>Comments</h2>
<div id="comments">
<noscript>
<div class="alert alert-warning" role="alert">
<span>Activate JavaScript to display comments</span>
</div>
</noscript>
<!-- Script loading comments -->
<script defer type="text/javascript">
window.addEventListener("load", function () {
Github.getComments(
"{{ site.repos | strip_newlines | strip_html | strip | normalize_whitespace | slugify | xml_escape }}",
"{{ page.issue | strip_newlines | strip_html | strip | normalize_whitespace | xml_escape | round }}",
function (error, comments) {
if (error) { throw new Error(error); }
comments.forEach(function (comment) {
Github.addComment("#comments", comment);
});
});
});
</script>
</div>