Files
.github
_data
_includes
_layouts
_sass
assets
docs
_data
_docs
_drafts
_includes
analytics-providers
comments-providers
custom.html
discourse.html
disqus.html
facebook.html
google-plus.html
scripts.html
staticman.html
footer
head
analytics.html
archive-single.html
author-profile-custom-links.html
author-profile.html
base_path
breadcrumbs.html
browser-upgrade.html
category-list.html
comment.html
comments.html
feature_row
figure
footer.html
gallery
group-by-array
head.html
masthead.html
nav_list
page__hero.html
page__hero_video.html
page__taxonomy.html
paginator.html
post_pagination.html
read-time.html
scripts.html
seo.html
sidebar.html
social-share.html
tag-list.html
toc
video
_layouts
_pages
_pets
_portfolio
_posts
_recipes
_sass
assets
Gemfile
_config.dev.yml
_config.yml
screenshot-layouts.png
screenshot.png
test
.editorconfig
.gitattributes
.gitignore
CHANGELOG.md
Gemfile
LICENSE.txt
README.md
Rakefile
_config.yml
banner.js
index.html
minimal-mistakes-jekyll.gemspec
package.json
screenshot-layouts.png
screenshot.png
website/docs/_includes/comments-providers/staticman.html
Michael Rose 57a4324fa0 Move gh-pages branch files into /docs and add test files
- Jekyll ignore `/docs` and `/test` folders when using from root
- Update Staticman config to point to correct branch and data file location
- Replace `{{ base_path }}` references with `absolute_url` filter
- Update documentation
2016-11-03 11:52:04 -04:00

42 lines
1.9 KiB
HTML

{% if site.repository and site.staticman.branch %}
<script>
(function ($) {
var $comments = $('.js-comments');
$('#new_comment').submit(function () {
var form = this;
$(form).addClass('disabled');
$('#comment-form-submit').html('<i class="fa fa-spinner fa-spin fa-fw"></i> {{ site.data.ui-text[site.locale].loading_label | default: "Loading..." }}');
$.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 %}