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.
@@ -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.
@@ -383,12 +383,12 @@
383
383
 
384
384
  var Validator = /** @class */ (function () {
385
385
  /**
386
- * @param element The datalist element. The element must have a data-url attribute to connect to a feed.
387
- */
386
+ * @param element The datalist element. The element must have a data-url attribute to connect to a feed.
387
+ */
388
388
  function Validator(element, options) {
389
389
  this.options = {
390
- errorAlert: 'There are errors on the form, please check your answers and try again.',
391
- useAjax: true
390
+ errorAlert: "There are errors on the form, please check your answers and try again.",
391
+ useAjax: true,
392
392
  };
393
393
  this.element = element;
394
394
  if (!this.element) {
@@ -399,7 +399,7 @@
399
399
  return rtn;
400
400
  }.bind(this);
401
401
  this.options = __assign(__assign({}, this.options), options);
402
- this.element.addEventListener('submit', function (e) {
402
+ this.element.addEventListener("submit", function (e) {
403
403
  e.preventDefault();
404
404
  e.stopImmediatePropagation();
405
405
  this.submitForm();
@@ -407,16 +407,13 @@
407
407
  var tag = '[data-submit="#' + this.element.id + '"]';
408
408
  var submitButtons = $(tag);
409
409
  if (submitButtons) {
410
- submitButtons.on('click', function (e) {
410
+ submitButtons.on("click", function (e) {
411
411
  e.preventDefault();
412
412
  e.stopImmediatePropagation();
413
- var exit = $(e.currentTarget).data('exit');
413
+ var exit = $(e.currentTarget).data("exit");
414
414
  if (exit) {
415
415
  $(this.element).find("input#exit").remove();
416
- $("<input id='exit' />").attr("type", "hidden")
417
- .attr("name", "exit")
418
- .attr("value", "true")
419
- .appendTo(this.element);
416
+ $("<input id='exit' />").attr("type", "hidden").attr("name", "exit").attr("value", "true").appendTo(this.element);
420
417
  }
421
418
  this.submitForm();
422
419
  }.bind(this));
@@ -424,15 +421,14 @@
424
421
  }
425
422
  Validator.prototype.submitForm = function () {
426
423
  var _a;
427
- this.element.classList.add('was-validated');
424
+ this.element.classList.add("was-validated");
428
425
  if (this.element.checkValidity()) {
429
- this.element.classList.add('loading');
430
- var checkboxes = this.element.querySelector('input[type=checkbox]');
426
+ this.element.classList.add("loading");
427
+ var checkboxes = this.element.querySelector("input[type=checkbox]");
431
428
  if (checkboxes) {
432
- Array.prototype.slice.call(checkboxes)
433
- .forEach(function (checkbox) {
434
- if ($(this).is(':checked')) {
435
- $(this).val('true');
429
+ Array.prototype.slice.call(checkboxes).forEach(function (checkbox) {
430
+ if ($(this).is(":checked")) {
431
+ $(this).val("true");
436
432
  }
437
433
  });
438
434
  }
@@ -446,7 +442,10 @@
446
442
  this.options.onComplete(data, this);
447
443
  }
448
444
  }.bind(this))
449
- .fail((_a = this.options.onError) !== null && _a !== void 0 ? _a : Inline.handleError);
445
+ .fail((_a = this.options.onError) !== null && _a !== void 0 ? _a : Inline.handleError)
446
+ .always(function () {
447
+ this.element.classList.remove("loading");
448
+ }.bind(this));
450
449
  }
451
450
  else {
452
451
  this.element.submit();