Sha256: 46b41e96f54b5921f9fdf1e674db21105e9a06de1328b9c2d03713cfd9cdca2e

Contents?: true

Size: 1.88 KB

Versions: 28

Compression:

Stored size: 1.88 KB

Contents

{% 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="fas 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 %}

Version data entries

28 entries across 14 versions & 2 rubygems

Version Path
minimal-mistakes-jekyll-4.14.1 _includes/comments-providers/staticman_v2.html
minimal-mistakes-jekyll-4.14.1 _includes/comments-providers/staticman.html
minimal-mistakes-jekyll-4.14.0 _includes/comments-providers/staticman_v2.html
minimal-mistakes-jekyll-4.14.0 _includes/comments-providers/staticman.html
minimal-mistakes-jekyll-4.13.0 _includes/comments-providers/staticman.html
minimal-mistakes-jekyll-4.13.0 _includes/comments-providers/staticman_v2.html
minimal-mistakes-jekyll-4.12.2 _includes/comments-providers/staticman.html
minimal-mistakes-jekyll-4.12.2 _includes/comments-providers/staticman_v2.html
minimal-mistakes-jekyll-4.12.1 _includes/comments-providers/staticman.html
minimal-mistakes-jekyll-4.12.1 _includes/comments-providers/staticman_v2.html
benimal-mistakes-jekyll-0.3.0 _includes/comments-providers/staticman_v2.html
benimal-mistakes-jekyll-0.3.0 _includes/comments-providers/staticman.html
benimal-mistakes-jekyll-0.2.0 _includes/comments-providers/staticman_v2.html
benimal-mistakes-jekyll-0.2.0 _includes/comments-providers/staticman.html
benimal-mistakes-jekyll-0.0.2 _includes/comments-providers/staticman_v2.html
benimal-mistakes-jekyll-0.0.2 _includes/comments-providers/staticman.html
benimal-mistakes-jekyll-0.0.1 _includes/comments-providers/staticman.html
benimal-mistakes-jekyll-0.0.1 _includes/comments-providers/staticman_v2.html
minimal-mistakes-jekyll-4.12.0 _includes/comments-providers/staticman_v2.html
minimal-mistakes-jekyll-4.12.0 _includes/comments-providers/staticman.html