hoodcms 6.0.5 → 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/dist/js/admin.js +2 -2
- package/dist/js/app/PropertyService.d.ts +5 -0
- package/dist/js/app/PropertyService.js +35 -23
- package/dist/js/app.js +8 -8
- package/dist/js/app.property.js +3 -3
- package/dist/js/core/Validator.d.ts +2 -2
- package/dist/js/core/Validator.js +18 -19
- package/dist/js/login.js +1 -1
- package/package.json +16 -16
- package/src/js/admin.js +19 -20
- package/src/js/admin.js.map +1 -1
- package/src/js/app.js +31 -29
- package/src/js/app.js.map +1 -1
- package/src/js/app.property.js +45 -34
- package/src/js/app.property.js.map +1 -1
- package/src/js/login.js +1 -1
- package/src/ts/app/PropertyService.ts +182 -176
- package/src/ts/core/Validator.ts +108 -109
package/src/js/app.property.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* hoodcms v6.0.
|
|
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
|
-
|
|
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:
|
|
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(
|
|
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(
|
|
410
|
+
submitButtons.on("click", function (e) {
|
|
411
411
|
e.preventDefault();
|
|
412
412
|
e.stopImmediatePropagation();
|
|
413
|
-
var exit = $(e.currentTarget).data(
|
|
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(
|
|
424
|
+
this.element.classList.add("was-validated");
|
|
428
425
|
if (this.element.checkValidity()) {
|
|
429
|
-
this.element.classList.add(
|
|
430
|
-
var checkboxes = this.element.querySelector(
|
|
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
|
-
|
|
434
|
-
|
|
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();
|
|
@@ -1037,9 +1036,13 @@
|
|
|
1037
1036
|
var PropertyService = /** @class */ (function () {
|
|
1038
1037
|
function PropertyService(options) {
|
|
1039
1038
|
this.options = {
|
|
1040
|
-
listElementId:
|
|
1041
|
-
mapListElementId:
|
|
1042
|
-
mapElementId:
|
|
1039
|
+
listElementId: "property-list",
|
|
1040
|
+
mapListElementId: "property-map-list",
|
|
1041
|
+
mapElementId: "property-map",
|
|
1042
|
+
mapLocationListId: "property-map-locations",
|
|
1043
|
+
renderPropertyPopup: function (location) {
|
|
1044
|
+
return "<div class=\"card border-0\" style=\"max-width:300px\">\n <div style=\"background-image:url(".concat(location.ImageUrl, ")\" class=\"rounded img-full img img-wide\"></div>\n <div class=\"card-body border-0\">\n <p style=\"overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\">\n <strong>").concat(location.Address1, ", ").concat(location.Postcode, "</strong>\n </p>\n <p>").concat(location.Description, "</p>\n <a href=\"").concat(location.MarkerUrl, "\" class=\"btn btn-block btn-primary\">Find out more...</a>\n </div>\n </div>");
|
|
1045
|
+
},
|
|
1043
1046
|
};
|
|
1044
1047
|
this.map = null;
|
|
1045
1048
|
this.center = { lat: 30, lng: -110 };
|
|
@@ -1063,8 +1066,8 @@
|
|
|
1063
1066
|
if (this.options.onListRender) {
|
|
1064
1067
|
this.options.onListRender(data, sender);
|
|
1065
1068
|
}
|
|
1066
|
-
Alerts.log(
|
|
1067
|
-
}.bind(this)
|
|
1069
|
+
Alerts.log("Finished loading property list.", "info");
|
|
1070
|
+
}.bind(this),
|
|
1068
1071
|
});
|
|
1069
1072
|
};
|
|
1070
1073
|
PropertyService.prototype.initMapList = function () {
|
|
@@ -1078,9 +1081,9 @@
|
|
|
1078
1081
|
if (this.options.onMapLoad) {
|
|
1079
1082
|
this.options.onMapLoad(data, sender);
|
|
1080
1083
|
}
|
|
1081
|
-
Alerts.log(
|
|
1084
|
+
Alerts.log("Finished loading map list.", "info");
|
|
1082
1085
|
this.reloadMarkers();
|
|
1083
|
-
}.bind(this)
|
|
1086
|
+
}.bind(this),
|
|
1084
1087
|
});
|
|
1085
1088
|
};
|
|
1086
1089
|
PropertyService.prototype.initMap = function () {
|
|
@@ -1089,15 +1092,19 @@
|
|
|
1089
1092
|
return;
|
|
1090
1093
|
}
|
|
1091
1094
|
this.center = { lat: +this.mapElement.dataset.lat, lng: +this.mapElement.dataset.long };
|
|
1095
|
+
var scrollwheel = false;
|
|
1096
|
+
if (this.mapElement.dataset.scrollwheel === "true") {
|
|
1097
|
+
scrollwheel = true;
|
|
1098
|
+
}
|
|
1092
1099
|
this.map = new google.maps.Map(this.mapElement, {
|
|
1093
1100
|
zoom: +this.mapElement.dataset.zoom || 15,
|
|
1094
1101
|
center: this.center,
|
|
1095
|
-
scrollwheel:
|
|
1102
|
+
scrollwheel: scrollwheel,
|
|
1096
1103
|
});
|
|
1097
1104
|
$(window).resize(function () {
|
|
1098
|
-
google.maps.event.trigger(this.map,
|
|
1105
|
+
google.maps.event.trigger(this.map, "resize");
|
|
1099
1106
|
}.bind(this));
|
|
1100
|
-
google.maps.event.trigger(this.map,
|
|
1107
|
+
google.maps.event.trigger(this.map, "resize");
|
|
1101
1108
|
this.initMapList();
|
|
1102
1109
|
};
|
|
1103
1110
|
PropertyService.prototype.reloadMarkers = function () {
|
|
@@ -1112,23 +1119,27 @@
|
|
|
1112
1119
|
}
|
|
1113
1120
|
}
|
|
1114
1121
|
this.markers = [];
|
|
1115
|
-
var
|
|
1122
|
+
var locationsElement = document.getElementById(this.options.mapLocationListId);
|
|
1123
|
+
if (!locationsElement) {
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
var locations = JSON.parse(locationsElement.dataset.locations);
|
|
1116
1127
|
locations.map(function (location, i) {
|
|
1117
1128
|
var marker = new google.maps.Marker({
|
|
1118
1129
|
position: new google.maps.LatLng(+location.Latitude, +location.Longitude),
|
|
1119
1130
|
map: this.map,
|
|
1120
|
-
optimized: true // makes SVG icons work in IE
|
|
1131
|
+
optimized: true, // makes SVG icons work in IE
|
|
1121
1132
|
});
|
|
1122
1133
|
if (this.mapElement.dataset.marker) {
|
|
1123
1134
|
marker.setIcon(this.mapElement.dataset.marker);
|
|
1124
1135
|
}
|
|
1125
|
-
marker.info =
|
|
1136
|
+
marker.info = this.options.renderPropertyPopup(location);
|
|
1126
1137
|
marker.addListener("click", function () {
|
|
1127
1138
|
if (infowindow) {
|
|
1128
1139
|
infowindow.close();
|
|
1129
1140
|
}
|
|
1130
1141
|
infowindow = new google.maps.InfoWindow({
|
|
1131
|
-
content: marker.info
|
|
1142
|
+
content: marker.info,
|
|
1132
1143
|
});
|
|
1133
1144
|
infowindow.open({
|
|
1134
1145
|
anchor: marker,
|