Add a link to add comments

Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
Valentin Popov 2018-10-01 05:09:23 +04:00
parent dbb5bfa521
commit f12fff5aba
Signed by: Valentin Popov
GPG Key ID: 269A00ACA90A8EA3

View File

@ -1,4 +1,8 @@
{% assign repos = site.repos | strip_newlines | strip_html | strip | normalize_whitespace | smartify | xml_escape %}
{% assign issue = page.issue | strip_newlines | strip_html | strip | normalize_whitespace | xml_escape | round %}
{% raw %} {% raw %}
<!-- Template -->
<script type="text/html" id="template"> <script type="text/html" id="template">
<div class="panel panel-default"> <div class="panel panel-default">
<!-- Title --> <!-- Title -->
@ -13,26 +17,32 @@
</script> </script>
{% endraw %} {% endraw %}
<!-- Header -->
<h2>Comments</h2> <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 --> <!-- List of comments -->
<script defer type="text/javascript"> <div id="comments"></div>
window.addEventListener("load", function () {
Github.getComments( <!-- Script loading comments -->
"{{ site.repos | strip_newlines | strip_html | strip | normalize_whitespace | smartify | xml_escape }}", <script defer type="text/javascript">
"{{ page.issue | strip_newlines | strip_html | strip | normalize_whitespace | xml_escape | round }}", window.addEventListener("load", function () {
function (error, comments) { Github.getComments("{{ repos }}", "{{ issue }}",
if (error) { throw new Error(error); } function (error, comments) {
comments.forEach(function (comment) { if (error) { throw new Error(error); }
Github.addComment("#comments", comment); comments.forEach(function (comment) {
}); Github.addComment("#comments", comment);
}); });
}); });
</script> });
</div> </script>
<noscript>
<div class="alert alert-warning" role="alert">
<span>Activate JavaScript to display comments</span>
</div>
</noscript>
<!-- Button -->
<a href="https://github.com/{{ repos }}/issues/{{ issue }}" class="btn btn-default btn-block" role="button">
<span>Add a comment</span>
</a>