hoodcms 6.0.7 → 6.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/js/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.7
2
+ * hoodcms v6.0.8
3
3
  * A fully customisable content management system built in ASP.NET Core 5 & Bootstrap 5.
4
4
  * Written by George Whysall, 2022
5
5
  * Released under the GPL-3.0 License.
@@ -30372,12 +30372,12 @@
30372
30372
 
30373
30373
  var Validator = /** @class */ (function () {
30374
30374
  /**
30375
- * @param element The datalist element. The element must have a data-url attribute to connect to a feed.
30376
- */
30375
+ * @param element The datalist element. The element must have a data-url attribute to connect to a feed.
30376
+ */
30377
30377
  function Validator(element, options) {
30378
30378
  this.options = {
30379
- errorAlert: 'There are errors on the form, please check your answers and try again.',
30380
- useAjax: true
30379
+ errorAlert: "There are errors on the form, please check your answers and try again.",
30380
+ useAjax: true,
30381
30381
  };
30382
30382
  this.element = element;
30383
30383
  if (!this.element) {
@@ -30388,7 +30388,7 @@
30388
30388
  return rtn;
30389
30389
  }.bind(this);
30390
30390
  this.options = __assign(__assign({}, this.options), options);
30391
- this.element.addEventListener('submit', function (e) {
30391
+ this.element.addEventListener("submit", function (e) {
30392
30392
  e.preventDefault();
30393
30393
  e.stopImmediatePropagation();
30394
30394
  this.submitForm();
@@ -30396,16 +30396,13 @@
30396
30396
  var tag = '[data-submit="#' + this.element.id + '"]';
30397
30397
  var submitButtons = $(tag);
30398
30398
  if (submitButtons) {
30399
- submitButtons.on('click', function (e) {
30399
+ submitButtons.on("click", function (e) {
30400
30400
  e.preventDefault();
30401
30401
  e.stopImmediatePropagation();
30402
- var exit = $(e.currentTarget).data('exit');
30402
+ var exit = $(e.currentTarget).data("exit");
30403
30403
  if (exit) {
30404
30404
  $(this.element).find("input#exit").remove();
30405
- $("<input id='exit' />").attr("type", "hidden")
30406
- .attr("name", "exit")
30407
- .attr("value", "true")
30408
- .appendTo(this.element);
30405
+ $("<input id='exit' />").attr("type", "hidden").attr("name", "exit").attr("value", "true").appendTo(this.element);
30409
30406
  }
30410
30407
  this.submitForm();
30411
30408
  }.bind(this));
@@ -30413,15 +30410,14 @@
30413
30410
  }
30414
30411
  Validator.prototype.submitForm = function () {
30415
30412
  var _a;
30416
- this.element.classList.add('was-validated');
30413
+ this.element.classList.add("was-validated");
30417
30414
  if (this.element.checkValidity()) {
30418
- this.element.classList.add('loading');
30419
- var checkboxes = this.element.querySelector('input[type=checkbox]');
30415
+ this.element.classList.add("loading");
30416
+ var checkboxes = this.element.querySelector("input[type=checkbox]");
30420
30417
  if (checkboxes) {
30421
- Array.prototype.slice.call(checkboxes)
30422
- .forEach(function (checkbox) {
30423
- if ($(this).is(':checked')) {
30424
- $(this).val('true');
30418
+ Array.prototype.slice.call(checkboxes).forEach(function (checkbox) {
30419
+ if ($(this).is(":checked")) {
30420
+ $(this).val("true");
30425
30421
  }
30426
30422
  });
30427
30423
  }
@@ -30435,7 +30431,10 @@
30435
30431
  this.options.onComplete(data, this);
30436
30432
  }
30437
30433
  }.bind(this))
30438
- .fail((_a = this.options.onError) !== null && _a !== void 0 ? _a : Inline.handleError);
30434
+ .fail((_a = this.options.onError) !== null && _a !== void 0 ? _a : Inline.handleError)
30435
+ .always(function () {
30436
+ this.element.classList.remove("loading");
30437
+ }.bind(this));
30439
30438
  }
30440
30439
  else {
30441
30440
  this.element.submit();