[Feature] Staticman v3 Support (#440)
* Added Staicman support * Corrected template for staticman.yml * Edit for coherence with _includes/disqus.html * Updated documentation for Staticman * Updated License to give credits to Michale Rose * Update LICENSE * add more staticman details to readme * Clearer instructions about reCAPTCHA in YML * Nest reCAPTCHA param inside Staticman * Prepend all css selectors with .staticman-comments Edit suggested by theme owner to avoid CSS rules overriding. * Add myself to the change log * Update _config.yml
This commit is contained in:
parent
018bac4894
commit
d1c8b2fee1
14 changed files with 976 additions and 4 deletions
47
_includes/staticman-script.html
Normal file
47
_includes/staticman-script.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
{% if site.staticman.repository and site.staticman.branch %}
|
||||
<!-- doing something a bit funky here because I want to be careful not to include JQuery twice! -->
|
||||
<script>
|
||||
if (typeof jQuery == 'undefined') {
|
||||
document.write('<script src="/beautiful-jekyll/js/jquery-1.11.2.min.js"></scr' + 'ipt>');
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
(function ($) {
|
||||
var $comments = $('.js-comments');
|
||||
|
||||
$('#new_comment').submit(function () {
|
||||
var form = this;
|
||||
|
||||
$(form).addClass('disabled');
|
||||
|
||||
$.ajax({
|
||||
type: $(this).attr('method'),
|
||||
url: $(this).attr('action'),
|
||||
data: $(this).serialize(),
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
success: function (data) {
|
||||
$('#comment-form-submit').html('{{ site.data.ui-text[site.locale].comment_btn_submitted | default: "Submitted" }}');
|
||||
$('.page__comments-form .js-notice').removeClass('notice--danger');
|
||||
$('.page__comments-form .js-notice').addClass('notice--success');
|
||||
showAlert('{{ 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." }}');
|
||||
},
|
||||
error: function (err) {
|
||||
console.log(err);
|
||||
$('#comment-form-submit').html('{{ site.data.ui-text[site.locale].comment_btn_submit | default: "Submit Comment" }}');
|
||||
$('.page__comments-form .js-notice').removeClass('notice--success');
|
||||
$('.page__comments-form .js-notice').addClass('notice--danger');
|
||||
showAlert('{{ 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." }}');
|
||||
$(form).removeClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
function showAlert(message) {
|
||||
$('.page__comments-form .js-notice').removeClass('hidden');
|
||||
$('.page__comments-form .js-notice-text').html(message);
|
||||
}
|
||||
})(jQuery);
|
||||
</script>
|
||||
{% endif %}
|
Loading…
Add table
Add a link
Reference in a new issue