|
| 1 | +{% assign locale = include.locale | default: site.locale %} |
1 | 2 | {% if site.repository and site.comments.staticman.branch %} |
2 | 3 | <script> |
3 | 4 | (function ($) { |
4 | 5 | $('#new_comment').submit(function () { |
5 | 6 | var form = this; |
6 | 7 |
|
7 | 8 | $(form).addClass('disabled'); |
8 | | - $('#comment-form-submit').html('<i class="fas fa-spinner fa-spin fa-fw"></i> {{ site.data.ui-text[site.locale].loading_label | default: "Loading..." }}'); |
| 9 | + $('#comment-form-submit').html('<i class="fas fa-spinner fa-spin fa-fw"></i> {{ site.data.ui-text[locale].loading_label | default: "Loading..." }}'); |
9 | 10 |
|
10 | 11 | $.ajax({ |
11 | 12 | type: $(this).attr('method'), |
12 | 13 | url: $(this).attr('action'), |
13 | 14 | data: $(this).serialize(), |
14 | 15 | contentType: 'application/x-www-form-urlencoded', |
15 | 16 | success: function (data) { |
16 | | - $('#comment-form-submit').html('{{ site.data.ui-text[site.locale].comment_btn_submitted | default: "Submitted" }}'); |
| 17 | + $('#comment-form-submit').html('{{ site.data.ui-text[locale].comment_btn_submitted | default: "Submitted" }}'); |
17 | 18 | $('.page__comments-form .js-notice').removeClass('notice--danger'); |
18 | 19 | $('.page__comments-form .js-notice').addClass('notice--success'); |
19 | | - 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." }}'); |
| 20 | + showAlert('{{ site.data.ui-text[locale].comment_success_msg | default: "Thanks for your comment! It will show on the site once it has been approved." }}'); |
20 | 21 | }, |
21 | 22 | error: function (err) { |
22 | 23 | console.log(err); |
23 | | - $('#comment-form-submit').html('{{ site.data.ui-text[site.locale].comment_btn_submit | default: "Submit Comment" }}'); |
| 24 | + $('#comment-form-submit').html('{{ site.data.ui-text[locale].comment_btn_submit | default: "Submit Comment" }}'); |
24 | 25 | $('.page__comments-form .js-notice').removeClass('notice--success'); |
25 | 26 | $('.page__comments-form .js-notice').addClass('notice--danger'); |
26 | | - 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." }}'); |
| 27 | + showAlert('{{ site.data.ui-text[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." }}'); |
27 | 28 | $(form).removeClass('disabled'); |
28 | 29 | } |
29 | 30 | }); |
|
0 commit comments