2018-12-25 23:21:42 +01:00
{% if site.staticman.repository and site.staticman.branch %}
2020-04-01 23:37:53 +02:00
< div class = "staticman-comments" >
2018-12-25 23:21:42 +01:00
< div class = "page__comments" >
<!-- Start static comments -->
< div class = "js-comments" >
{% if site.data.comments[page.slug] %}
< h3 class = "page__comments-title" > {{ site.data.ui-text[site.locale].comments_title | default: "Comments" }}< / h3 >
{% assign comments = site.data.comments[page.slug] | sort %}
{% for comment in comments %}
{% assign email = comment[1].email %}
{% assign name = comment[1].name %}
{% assign url = comment[1].url %}
{% assign date = comment[1].date %}
{% assign message = comment[1].message %}
{% include staticman-comment.html index=forloop.index email=email name=name url=url date=date message=message %}
{% endfor %}
{% endif %}
< / div >
<!-- End static comments -->
<!-- Start new comment form -->
< div class = "page__comments-form" >
< h3 class = "page__comments-title" > {{ site.data.ui-text[site.locale].comments_label | default: "Leave a Comment" }}< / h3 >
< p class = "small" > {{ site.data.ui-text[site.locale].comment_form_info | default: "Your email address will not be published. Required fields are marked" }} < span class = "required" > *< / span > < / p >
2019-07-31 04:24:50 +02:00
< form id = "new_comment" class = "page__comments-form js-form form" method = "post" >
2018-12-25 23:21:42 +01:00
< div class = "form-group" >
< label for = "comment-form-message" > {{ site.data.ui-text[site.locale].comment_form_comment_label | default: "Comment" }} < small class = "required" > *< / small > < / label > < br >
< textarea type = "text" rows = "12" cols = "36" id = "comment-form-message" name = "fields[message]" tabindex = "1" > < / textarea >
2020-05-02 08:10:20 +02:00
< div class = "small form-text" > < a href = "https://daringfireball.net/projects/markdown/" > {{ site.data.ui-text[site.locale].comment_form_md_info | default: "Markdown is supported." }}< / a > < / div >
2018-12-25 23:21:42 +01:00
< / div >
< div class = "form-group" >
< label for = "comment-form-name" > {{ site.data.ui-text[site.locale].comment_form_name_label | default: "Name" }} < small class = "required" > *< / small > < / label >
< input type = "text" id = "comment-form-name" name = "fields[name]" tabindex = "2" / >
< / div >
< div class = "form-group" >
< label for = "comment-form-email" > {{ site.data.ui-text[site.locale].comment_form_email_label | default: "Email address" }} < small class = "required" > *< / small > < / label >
< input type = "email" id = "comment-form-email" name = "fields[email]" tabindex = "3" / >
< / div >
< div class = "form-group" >
< label for = "comment-form-url" > {{ site.data.ui-text[site.locale].comment_form_website_label | default: "Website (optional)" }}< / label >
< input type = "url" id = "comment-form-url" name = "fields[url]" tabindex = "4" / >
< / div >
2020-07-13 07:09:27 +02:00
< div class = "form-group d-none" style = "display: none;" >
2018-12-25 23:21:42 +01:00
< input type = "hidden" name = "options[origin]" value = "{{ page.url | absolute_url }}" >
< input type = "hidden" name = "options[slug]" value = "{{ page.slug }}" >
< label for = "comment-form-location" > Not used. Leave blank if you are a human.< / label >
< input type = "text" id = "comment-form-location" name = "fields[hidden]" autocomplete = "off" / >
{% if site.staticman.reCaptcha.siteKey %}< input type = "hidden" name = "options[reCaptcha][siteKey]" value = "{{ site.staticman.reCaptcha.siteKey }}" > {% endif %}
{% if site.staticman.reCaptcha.secret %}< input type = "hidden" name = "options[reCaptcha][secret]" value = "{{ site.staticman.reCaptcha.secret }}" > {% endif %}
< / div >
<!-- Start comment form alert messaging -->
2020-07-13 07:09:27 +02:00
< p class = "d-none js-notice alert" >
< strong class = "js-notice-text-success d-none" > {{ site.data.ui-text[site.locale].comment_success_msg | default: "Thanks for your comment! It will show on the site once it has been approved." }}< / strong >
< strong class = "js-notice-text-failure d-none" > {{ site.data.ui-text[site.locale].comment_error_msg | default: "Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again." }}< / strong >
2018-12-25 23:21:42 +01:00
< / p >
<!-- End comment form alert messaging -->
{% if site.staticman.reCaptcha.siteKey %}
< div class = "form-group" >
< div class = "g-recaptcha" data-sitekey = "{{ site.staticman.reCaptcha.siteKey }}" > < / div >
< / div >
{% endif %}
< div class = "form-group" >
2020-07-13 07:09:27 +02:00
< button type = "submit" id = "comment-form-submit" tabindex = "5" class = "btn btn-primary btn-lg" > {{ site.data.ui-text[site.locale].comment_btn_submit | default: "Submit Comment" }}< / button >
< button type = "submit" id = "comment-form-submitted" tabindex = "5" class = "btn btn-primary btn-lg d-none" disabled > {{ site.data.ui-text[site.locale].comment_btn_submitted | default: "Submitted" }}< / button >
2018-12-25 23:21:42 +01:00
< / div >
< / form >
< / div >
<!-- End new comment form -->
<!-- Load reCaptcha if site key is set -->
{% if site.staticman.reCaptcha.siteKey %}
< script async src = "https://www.google.com/recaptcha/api.js" > < / script >
{% endif %}
< / div >
2019-07-31 04:24:50 +02:00
2018-12-25 23:21:42 +01:00
<!-- Load script to handle comment form submission -->
2019-07-31 04:24:50 +02:00
<!-- doing something a bit funky here because I want to be careful not to include JQuery twice! -->
< script >
if (typeof jQuery == 'undefined') {
2020-07-12 07:18:39 +02:00
document.write('< script src = "{{ " / assets / js / jquery-3 . 4 . 1 . min . js " | relative_url } } " > < / s c r ' + ' i p t > ' ) ;
2019-07-31 04:24:50 +02:00
}
< / script >
2020-04-27 16:18:00 +02:00
< script src = "{{ " / assets / js / staticman . js " | relative_url } } " > < / script >
2020-04-01 23:37:53 +02:00
< / div >
2018-12-25 23:21:42 +01:00
{% endif %}