hoodcms 6.0.4 → 6.0.7

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.4
2
+ * hoodcms v6.0.7
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.
@@ -1037,9 +1037,13 @@
1037
1037
  var PropertyService = /** @class */ (function () {
1038
1038
  function PropertyService(options) {
1039
1039
  this.options = {
1040
- listElementId: 'property-list',
1041
- mapListElementId: 'property-map-list',
1042
- mapElementId: 'property-map'
1040
+ listElementId: "property-list",
1041
+ mapListElementId: "property-map-list",
1042
+ mapElementId: "property-map",
1043
+ mapLocationListId: "property-map-locations",
1044
+ renderPropertyPopup: function (location) {
1045
+ 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>");
1046
+ },
1043
1047
  };
1044
1048
  this.map = null;
1045
1049
  this.center = { lat: 30, lng: -110 };
@@ -1063,8 +1067,8 @@
1063
1067
  if (this.options.onListRender) {
1064
1068
  this.options.onListRender(data, sender);
1065
1069
  }
1066
- Alerts.log('Finished loading property list.', 'info');
1067
- }.bind(this)
1070
+ Alerts.log("Finished loading property list.", "info");
1071
+ }.bind(this),
1068
1072
  });
1069
1073
  };
1070
1074
  PropertyService.prototype.initMapList = function () {
@@ -1078,9 +1082,9 @@
1078
1082
  if (this.options.onMapLoad) {
1079
1083
  this.options.onMapLoad(data, sender);
1080
1084
  }
1081
- Alerts.log('Finished loading map list.', 'info');
1085
+ Alerts.log("Finished loading map list.", "info");
1082
1086
  this.reloadMarkers();
1083
- }.bind(this)
1087
+ }.bind(this),
1084
1088
  });
1085
1089
  };
1086
1090
  PropertyService.prototype.initMap = function () {
@@ -1089,15 +1093,19 @@
1089
1093
  return;
1090
1094
  }
1091
1095
  this.center = { lat: +this.mapElement.dataset.lat, lng: +this.mapElement.dataset.long };
1096
+ var scrollwheel = false;
1097
+ if (this.mapElement.dataset.scrollwheel === "true") {
1098
+ scrollwheel = true;
1099
+ }
1092
1100
  this.map = new google.maps.Map(this.mapElement, {
1093
1101
  zoom: +this.mapElement.dataset.zoom || 15,
1094
1102
  center: this.center,
1095
- scrollwheel: false
1103
+ scrollwheel: scrollwheel,
1096
1104
  });
1097
1105
  $(window).resize(function () {
1098
- google.maps.event.trigger(this.map, 'resize');
1106
+ google.maps.event.trigger(this.map, "resize");
1099
1107
  }.bind(this));
1100
- google.maps.event.trigger(this.map, 'resize');
1108
+ google.maps.event.trigger(this.map, "resize");
1101
1109
  this.initMapList();
1102
1110
  };
1103
1111
  PropertyService.prototype.reloadMarkers = function () {
@@ -1112,23 +1120,27 @@
1112
1120
  }
1113
1121
  }
1114
1122
  this.markers = [];
1115
- var locations = $("#property-map-locations").data('locations');
1123
+ var locationsElement = document.getElementById(this.options.mapLocationListId);
1124
+ if (!locationsElement) {
1125
+ return;
1126
+ }
1127
+ var locations = JSON.parse(locationsElement.dataset.locations);
1116
1128
  locations.map(function (location, i) {
1117
1129
  var marker = new google.maps.Marker({
1118
1130
  position: new google.maps.LatLng(+location.Latitude, +location.Longitude),
1119
1131
  map: this.map,
1120
- optimized: true // makes SVG icons work in IE
1132
+ optimized: true, // makes SVG icons work in IE
1121
1133
  });
1122
1134
  if (this.mapElement.dataset.marker) {
1123
1135
  marker.setIcon(this.mapElement.dataset.marker);
1124
1136
  }
1125
- marker.info = "<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>");
1137
+ marker.info = this.options.renderPropertyPopup(location);
1126
1138
  marker.addListener("click", function () {
1127
1139
  if (infowindow) {
1128
1140
  infowindow.close();
1129
1141
  }
1130
1142
  infowindow = new google.maps.InfoWindow({
1131
- content: marker.info
1143
+ content: marker.info,
1132
1144
  });
1133
1145
  infowindow.open({
1134
1146
  anchor: marker,