hoodcms 6.0.6 → 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.
package/dist/js/admin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.6
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.
@@ -11,6 +11,7 @@ export interface PropertyServiceOptions {
11
11
  listElementId?: string;
12
12
  mapListElementId?: string;
13
13
  mapElementId?: string;
14
+ mapLocationListId?: string;
14
15
  /**
15
16
  * Called before the data is fetched.
16
17
  */
@@ -27,6 +28,10 @@ export interface PropertyServiceOptions {
27
28
  * Called before the fetched HTML is rendered to the list. Must return the data back to datalist to render.
28
29
  */
29
30
  onMapRender?: (sender?: HTMLElement) => string;
31
+ /**
32
+ * Renders the popup on the property map, location is the property map marker object sent from the server for that property.
33
+ */
34
+ renderPropertyPopup?: (location?: any) => string;
30
35
  }
31
36
  export declare class PropertyService {
32
37
  options: PropertyServiceOptions;
@@ -4,9 +4,22 @@ import { DataList } from "../core/DataList";
4
4
  export class PropertyService {
5
5
  constructor(options) {
6
6
  this.options = {
7
- listElementId: 'property-list',
8
- mapListElementId: 'property-map-list',
9
- mapElementId: 'property-map'
7
+ listElementId: "property-list",
8
+ mapListElementId: "property-map-list",
9
+ mapElementId: "property-map",
10
+ mapLocationListId: "property-map-locations",
11
+ renderPropertyPopup: function (location) {
12
+ return `<div class="card border-0" style="max-width:300px">
13
+ <div style="background-image:url(${location.ImageUrl})" class="rounded img-full img img-wide"></div>
14
+ <div class="card-body border-0">
15
+ <p style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
16
+ <strong>${location.Address1}, ${location.Postcode}</strong>
17
+ </p>
18
+ <p>${location.Description}</p>
19
+ <a href="${location.MarkerUrl}" class="btn btn-block btn-primary">Find out more...</a>
20
+ </div>
21
+ </div>`;
22
+ },
10
23
  };
11
24
  this.map = null;
12
25
  this.center = { lat: 30, lng: -110 };
@@ -28,8 +41,8 @@ export class PropertyService {
28
41
  if (this.options.onListRender) {
29
42
  this.options.onListRender(data, sender);
30
43
  }
31
- Alerts.log('Finished loading property list.', 'info');
32
- }.bind(this)
44
+ Alerts.log("Finished loading property list.", "info");
45
+ }.bind(this),
33
46
  });
34
47
  }
35
48
  initMapList() {
@@ -42,9 +55,9 @@ export class PropertyService {
42
55
  if (this.options.onMapLoad) {
43
56
  this.options.onMapLoad(data, sender);
44
57
  }
45
- Alerts.log('Finished loading map list.', 'info');
58
+ Alerts.log("Finished loading map list.", "info");
46
59
  this.reloadMarkers();
47
- }.bind(this)
60
+ }.bind(this),
48
61
  });
49
62
  }
50
63
  initMap() {
@@ -53,15 +66,19 @@ export class PropertyService {
53
66
  return;
54
67
  }
55
68
  this.center = { lat: +this.mapElement.dataset.lat, lng: +this.mapElement.dataset.long };
69
+ let scrollwheel = false;
70
+ if (this.mapElement.dataset.scrollwheel === "true") {
71
+ scrollwheel = true;
72
+ }
56
73
  this.map = new google.maps.Map(this.mapElement, {
57
74
  zoom: +this.mapElement.dataset.zoom || 15,
58
75
  center: this.center,
59
- scrollwheel: false
76
+ scrollwheel: scrollwheel,
60
77
  });
61
78
  $(window).resize(function () {
62
- google.maps.event.trigger(this.map, 'resize');
79
+ google.maps.event.trigger(this.map, "resize");
63
80
  }.bind(this));
64
- google.maps.event.trigger(this.map, 'resize');
81
+ google.maps.event.trigger(this.map, "resize");
65
82
  this.initMapList();
66
83
  }
67
84
  reloadMarkers() {
@@ -76,32 +93,27 @@ export class PropertyService {
76
93
  }
77
94
  }
78
95
  this.markers = [];
79
- var locations = $("#property-map-locations").data('locations');
96
+ var locationsElement = document.getElementById(this.options.mapLocationListId);
97
+ if (!locationsElement) {
98
+ return;
99
+ }
100
+ var locations = JSON.parse(locationsElement.dataset.locations);
80
101
  locations.map(function (location, i) {
81
102
  let marker = new google.maps.Marker({
82
103
  position: new google.maps.LatLng(+location.Latitude, +location.Longitude),
83
104
  map: this.map,
84
- optimized: true // makes SVG icons work in IE
105
+ optimized: true, // makes SVG icons work in IE
85
106
  });
86
107
  if (this.mapElement.dataset.marker) {
87
108
  marker.setIcon(this.mapElement.dataset.marker);
88
109
  }
89
- marker.info = `<div class="card border-0" style="max-width:300px">
90
- <div style="background-image:url(${location.ImageUrl})" class="rounded img-full img img-wide"></div>
91
- <div class="card-body border-0">
92
- <p style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
93
- <strong>${location.Address1}, ${location.Postcode}</strong>
94
- </p>
95
- <p>${location.Description}</p>
96
- <a href="${location.MarkerUrl}" class="btn btn-block btn-primary">Find out more...</a>
97
- </div>
98
- </div>`;
110
+ marker.info = this.options.renderPropertyPopup(location);
99
111
  marker.addListener("click", () => {
100
112
  if (infowindow) {
101
113
  infowindow.close();
102
114
  }
103
115
  infowindow = new google.maps.InfoWindow({
104
- content: marker.info
116
+ content: marker.info,
105
117
  });
106
118
  infowindow.open({
107
119
  anchor: marker,
package/dist/js/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.6
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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.6
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.
@@ -20,5 +20,5 @@ PERFORMANCE OF THIS SOFTWARE.
20
20
  ***************************************************************************** */
21
21
  var extendStatics=function(t,e){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e;}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);},extendStatics(t,e)};function __extends(t,e){function r(){this.constructor=t;}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r);}var __assign=function(){return __assign=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},__assign.apply(this,arguments)};"function"!=typeof Object.create&&(Object.create=function(t){function o(){}return o.prototype=t,new o}),function(t,o,i,s){var n={_positionClasses:["bottom-left","bottom-right","top-right","top-left","bottom-center","top-center","mid-center"],_defaultIcons:["success","error","info","warning"],init:function(o,i){this.prepareOptions(o,t.toast.options),this.process();},prepareOptions:function(o,i){var s={};"string"==typeof o||o instanceof Array?s.text=o:s=o,this.options=t.extend({},i,s);},process:function(){this.setup(),this.addToDom(),this.position(),this.bindToast(),this.animate();},setup:function(){var o="";if(this._toastEl=this._toastEl||t("<div></div>",{class:"jq-toast-single"}),o+='<span class="jq-toast-loader"></span>',this.options.allowToastClose&&(o+='<span class="close-jq-toast-single">&times;</span>'),this.options.text instanceof Array){this.options.heading&&(o+='<h2 class="jq-toast-heading">'+this.options.heading+"</h2>"),o+='<ul class="jq-toast-ul">';for(var i=0;i<this.options.text.length;i++)o+='<li class="jq-toast-li" id="jq-toast-item-'+i+'">'+this.options.text[i]+"</li>";o+="</ul>";}else this.options.heading&&(o+='<h2 class="jq-toast-heading">'+this.options.heading+"</h2>"),o+=this.options.text;this._toastEl.html(o),!1!==this.options.bgColor&&this._toastEl.css("background-color",this.options.bgColor),!1!==this.options.textColor&&this._toastEl.css("color",this.options.textColor),this.options.textAlign&&this._toastEl.css("text-align",this.options.textAlign),!1!==this.options.icon&&(this._toastEl.addClass("jq-has-icon"),-1!==t.inArray(this.options.icon,this._defaultIcons)&&this._toastEl.addClass("jq-icon-"+this.options.icon)),!1!==this.options.class&&this._toastEl.addClass(this.options.class);},position:function(){"string"==typeof this.options.position&&-1!==t.inArray(this.options.position,this._positionClasses)?"bottom-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,bottom:20}):"top-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,top:20}):"mid-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,top:t(o).outerHeight()/2-this._container.outerHeight()/2}):this._container.addClass(this.options.position):"object"==typeof this.options.position?this._container.css({top:this.options.position.top?this.options.position.top:"auto",bottom:this.options.position.bottom?this.options.position.bottom:"auto",left:this.options.position.left?this.options.position.left:"auto",right:this.options.position.right?this.options.position.right:"auto"}):this._container.addClass("bottom-left");},bindToast:function(){var t=this;this._toastEl.on("afterShown",(function(){t.processLoader();})),this._toastEl.find(".close-jq-toast-single").on("click",(function(o){o.preventDefault(),"fade"===t.options.showHideTransition?(t._toastEl.trigger("beforeHide"),t._toastEl.fadeOut((function(){t._toastEl.trigger("afterHidden");}))):"slide"===t.options.showHideTransition?(t._toastEl.trigger("beforeHide"),t._toastEl.slideUp((function(){t._toastEl.trigger("afterHidden");}))):(t._toastEl.trigger("beforeHide"),t._toastEl.hide((function(){t._toastEl.trigger("afterHidden");})));})),"function"==typeof this.options.beforeShow&&this._toastEl.on("beforeShow",(function(){t.options.beforeShow();})),"function"==typeof this.options.afterShown&&this._toastEl.on("afterShown",(function(){t.options.afterShown();})),"function"==typeof this.options.beforeHide&&this._toastEl.on("beforeHide",(function(){t.options.beforeHide();})),"function"==typeof this.options.afterHidden&&this._toastEl.on("afterHidden",(function(){t.options.afterHidden();}));},addToDom:function(){var o=t(".jq-toast-wrap");if(0===o.length?(o=t("<div></div>",{class:"jq-toast-wrap"}),t("body").append(o)):(!this.options.stack||isNaN(parseInt(this.options.stack,10)))&&o.empty(),o.find(".jq-toast-single:hidden").remove(),o.append(this._toastEl),this.options.stack&&!isNaN(parseInt(this.options.stack),10)){var i=o.find(".jq-toast-single").length-this.options.stack;i>0&&t(".jq-toast-wrap").find(".jq-toast-single").slice(0,i).remove();}this._container=o;},canAutoHide:function(){return !1!==this.options.hideAfter&&!isNaN(parseInt(this.options.hideAfter,10))},processLoader:function(){if(!this.canAutoHide()||!1===this.options.loader)return !1;var t=this._toastEl.find(".jq-toast-loader"),o=(this.options.hideAfter-400)/1e3+"s",i=this.options.loaderBg,s=t.attr("style")||"";s=s.substring(0,s.indexOf("-webkit-transition")),s+="-webkit-transition: width "+o+" ease-in; -o-transition: width "+o+" ease-in; transition: width "+o+" ease-in; background-color: "+i+";",t.attr("style",s).addClass("jq-toast-loaded");},animate:function(){var t=this;if(this._toastEl.hide(),this._toastEl.trigger("beforeShow"),"fade"===this.options.showHideTransition.toLowerCase()?this._toastEl.fadeIn((function(){t._toastEl.trigger("afterShown");})):"slide"===this.options.showHideTransition.toLowerCase()?this._toastEl.slideDown((function(){t._toastEl.trigger("afterShown");})):this._toastEl.show((function(){t._toastEl.trigger("afterShown");})),this.canAutoHide()){t=this;o.setTimeout((function(){"fade"===t.options.showHideTransition.toLowerCase()?(t._toastEl.trigger("beforeHide"),t._toastEl.fadeOut((function(){t._toastEl.trigger("afterHidden");}))):"slide"===t.options.showHideTransition.toLowerCase()?(t._toastEl.trigger("beforeHide"),t._toastEl.slideUp((function(){t._toastEl.trigger("afterHidden");}))):(t._toastEl.trigger("beforeHide"),t._toastEl.hide((function(){t._toastEl.trigger("afterHidden");})));}),this.options.hideAfter);}},reset:function(o){"all"===o?t(".jq-toast-wrap").remove():this._toastEl.remove();},update:function(t){this.prepareOptions(t,this.options),this.setup(),this.bindToast();}};t.toast=function(t){var o=Object.create(n);return o.init(t,this),{reset:function(t){o.reset(t);},update:function(t){o.update(t);}}},t.toast.options={text:"",heading:"",showHideTransition:"fade",allowToastClose:!0,hideAfter:3e3,loader:!0,loaderBg:"#9EC600",stack:5,position:"bottom-left",bgColor:!1,textColor:!1,textAlign:"left",icon:!1,beforeShow:function(){},afterShown:function(){},beforeHide:function(){},afterHidden:function(){}};}(jQuery,window);var BootstrapSwal=swal__default["default"].mixin({customClass:{confirmButton:"btn btn-success m-1 px-3",cancelButton:"btn btn-danger m-1 px-3"},buttonsStyling:!1}),Alerts=function(){function o(){}return o.log=function(o,t){if(void 0===t&&(t="message"),document.body.classList.contains("dev-mode"))switch(t){case"error":console.error(o);break;case"message":console.log(o);break;case"warning":console.warn(o);break;case"info":console.info(o);}},o.error=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#d0100b",textColor:"white",hideAfter:e});},o.warning=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#ef9007",textColor:"white",hideAfter:e});},o.message=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#222222",textColor:"white",hideAfter:e});},o.success=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#28a745",textColor:"white",hideAfter:e});},o.alert=function(t,e,n,i){switch(void 0===e&&(e=null),void 0===n&&(n="info"),void 0===i&&(i=1e4),n){case"error":o.error(t,e,i);break;case"warning":o.warning(t,e,i);break;case"info":o.message(t,e,i);break;case"success":o.success(t,e,i);}},o.sweetAlert=function(o,t){BootstrapSwal.fire(o).then((function(o){t(o);}));},o.confirm=function(t,e){o.sweetAlert(__assign(__assign({},{showCancelButton:!0,footer:null,title:"Are you sure?",html:"Are you sure you want to do this?",confirmButtonText:"Ok",cancelButtonText:"Cancel"}),t),e);},o.prompt=function(t,e){o.sweetAlert(__assign(__assign({},{input:"text",inputAttributes:{autocapitalize:"off"},showCancelButton:!0,icon:"info",footer:'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',confirmButtonText:"Ok",cancelButtonText:"Cancel"}),t),e);},o.prototype.log=function(t,e){void 0===e&&(e="message"),o.log(t,e);},o.prototype.error=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.error(t,e,n);},o.prototype.warning=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.warning(t,e,n);},o.prototype.message=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.message(t,e,n);},o.prototype.success=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.success(t,e,n);},o.prototype.alert=function(t,e,n,i){void 0===n&&(n="info"),void 0===i&&(i=1e4),o.alert(t,t,n,i);},o.prototype.sweetAlert=function(t,e){o.sweetAlert(t,e);},o.prototype.confirm=function(t,e){o.confirm(t,e);},o.prototype.prompt=function(t,e){o.prompt(t,e);},o}();var Inline=function(){function o(){}return o.load=function(n,r){var t,e=$(n);e.addClass("loading"),r.onLoad&&r.onLoad(n);var l=e.data("url");$.get(l,(function(o){r.onRender&&(o=r.onRender(o,n)),e.html(o),e.removeClass("loading"),r.onComplete&&r.onComplete(o,n);})).fail(null!==(t=r.onError)&&void 0!==t?t:o.handleError);},o.task=function(n,r,t,e){void 0===t&&(t=null),void 0===e&&(e=null),r&&r.classList.add("loading"),$.get(n,(function(o){r&&r.classList.remove("loading"),t&&t(o,r);})).fail(null!=e?e:o.handleError);},o.post=function(n,r,t,e){void 0===t&&(t=null),void 0===e&&(e=null),r&&r.classList.add("loading"),$.post(n,(function(o){r&&r.classList.remove("loading"),t&&t(o,r);})).fail(null!=e?e:o.handleError);},o.handleError=function(o,n,r){500===o.status?Alerts.error("There was an error processing the content, please contact an administrator if this continues.","Error "+o.status,1e4):404===o.status?Alerts.error("The content could not be found.","Error "+o.status,1e4):401===o.status&&(Alerts.error("You are not allowed to view this resource, are you logged in correctly?","Error "+o.status,1e4),window.location=window.location);},o}();var DataList=function(){function e(e,t){if(this.element=e,this.element.hoodDataList=this,void 0!==e&&null!=e){if(this.options=__assign(__assign({},this.options),t),$(this.element).hasClass("query")){var a=null;if(a=new RegExp("^(?:[a-z]+:)?//","i").test(this.element.dataset.url)?new URL(this.element.dataset.url):new URL(window.location.origin+this.element.dataset.url),"URLSearchParams"in window){var n=new URLSearchParams(window.location.search),i=new URLSearchParams(a.search);n.forEach((function(e,t,a){i.set(t,e);})),"0"==i.get("page")&&i.set("page","1"),a.search=i.toString();}else a.search=window.location.search;var r=a.pathname+a.search;$(this.element).attr("data-url",r),$(this.element).data("url",r);}if(!$(this.element).hasClass("refresh-only")){var s=document.createElement("a");s.href=$(this.element).data("url"),this.reload(new URL(s.href));}$(this.element).on("click",".pagination a, a.hood-inline-list-target",function(e){e.preventDefault();var t=document.createElement("a");t.href=e.currentTarget.href;var a=document.createElement("a");a.href=$(this.element).data("url"),a.search=t.search,this.reload(new URL(a.href));}.bind(this)),$("body").on("submit",'form.inline[data-target="#'.concat(this.element.id,'"]'),function(e){e.preventDefault();var t=$(e.currentTarget),a=document.createElement("a");a.href=$(this.element).data("url"),a.search="?"+t.serialize(),this.reload(new URL(a.href));}.bind(this));}else Alerts.log("Could not DataList to element, element does not exist.","error");}return e.prototype.reload=function(e){if(void 0===e&&(e=null),e){if(history.pushState&&$(this.element).hasClass("query")){var t=window.location.protocol+"//"+window.location.host+window.location.pathname+(e.href.contains("?")?"?"+e.href.substring(e.href.indexOf("?")+1):"");window.history.pushState({path:t},"",t);}$(this.element).data("url",e);}Inline.load(this.element,__assign({},this.options));},e}();
22
22
  var Validator=function(){function t(t,i){if(this.options={errorAlert:"There are errors on the form, please check your answers and try again.",useAjax:!0},this.element=t,this.element){this.options.serializationFunction=function(){return $(this.element).serialize()}.bind(this),this.options=__assign(__assign({},this.options),i),this.element.addEventListener("submit",function(t){t.preventDefault(),t.stopImmediatePropagation(),this.submitForm();}.bind(this));var e='[data-submit="#'+this.element.id+'"]',n=$(e);n&&n.on("click",function(t){t.preventDefault(),t.stopImmediatePropagation(),$(t.currentTarget).data("exit")&&($(this.element).find("input#exit").remove(),$("<input id='exit' />").attr("type","hidden").attr("name","exit").attr("value","true").appendTo(this.element)),this.submitForm();}.bind(this));}}return t.prototype.submitForm=function(){var t;if(this.element.classList.add("was-validated"),this.element.checkValidity()){this.element.classList.add("loading");var i=this.element.querySelector("input[type=checkbox]");if(i&&Array.prototype.slice.call(i).forEach((function(t){$(this).is(":checked")&&$(this).val("true");})),this.options.onSubmit&&this.options.onSubmit(this),this.options.useAjax){var e=this.options.serializationFunction();$.post(this.element.action,e,function(t){this.options.onComplete&&this.options.onComplete(t,this);}.bind(this)).fail(null!==(t=this.options.onError)&&void 0!==t?t:Inline.handleError);}else this.element.submit();}else this.options.errorAlert&&Alerts.error(this.options.errorAlert,null,5e3);},t}();var Handlers=function(){function t(){}return t.prototype.initDefaultHandlers=function(){this.checkboxToCsvInput(),this.iconSelector(),this.initSelectValues(),this.scrollHandlers(),this.selectText(),this.setValueOnClick(),this.submitOnChange();},t.prototype.initSelectValues=function(t){void 0===t&&(t="body"),$(t).find("select[data-selected]").each(this.initSelectValuesHandler);},t.prototype.initSelectValuesHandler=function(t,e){var o=$(this).data("selected");if("undefined"!==o&&""!==o){var a=String(o);$(this).val(a);}},t.prototype.iconSelector=function(t){void 0===t&&(t="body"),$(t).find("[data-hood-icon]").each(this.iconSelectorHandler);},t.prototype.iconSelectorHandler=function(t,e){var o=$(this),a=o.find("input[data-hood-icon-input]"),n=o.find("[data-hood-icon-display]"),i=o.find(".collapse");o.find("[data-hood-icon-key][data-hood-icon-value]").on("click",(function(){o.find("[data-hood-icon-key][data-hood-icon-value]").removeClass("active"),$(this).addClass("active");var t=$(this).data("hoodIconKey"),e=$(this).data("hoodIconValue");$(this),n.html(e),a.val(t),i&&i.removeClass("show");}));},t.prototype.selectText=function(t){void 0===t&&(t="body"),$(t).on("click",".select-text",this.selectTextHandler);},t.prototype.selectTextHandler=function(){var t=$(this);t.select(),t.mouseup((function(){return t.unbind("mouseup"),!1}));},t.prototype.scrollHandlers=function(t){void 0===t&&(t="body"),$(t).on("click",".scroll-top, .scroll-to-top",this.scrollTop),$(t).on("click",".scroll-target, .scroll-to-target",this.scrollTarget),$(t).on("click",".scroll-target-direct, .scroll-to-target-direct",this.scrollTargetDirect);},t.prototype.scrollTop=function(t){return t&&t.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},t.prototype.scrollTarget=function(t){t&&t.preventDefault();var e=$(this).attr("href").split("#")[0];if(e===window.location.pathname||""===e){var o=this.hash,a=$(o),n=$("header.header"),i=0;n&&(i=n.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:a.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:a.offset().top-i},900,"swing");}},t.prototype.scrollTargetDirect=function(){var t=$("body").scrollTop(),e=$($(this).attr("href")).offset().top;return $("html, body").animate({scrollTop:e},Math.abs(e-t)),!1},t.prototype.checkboxToCsvInput=function(t){void 0===t&&(t="body"),$(t).on("change","input[type=checkbox][data-hood-csv-input]",this.checkboxToCsvInputHandler);},t.prototype.checkboxToCsvInputHandler=function(t){t&&t.preventDefault();var e=new Array;$('input[data-hood-csv-input="'+$(this).data("hoodCsvInput")+'"]').each((function(){$(this).is(":checked")&&e.push($(this).val());}));var o="#"+$(this).data("input"),a=JSON.stringify(e);$(o).val(a);},t.prototype.submitOnChange=function(t){void 0===t&&(t="body"),$(t).on("change",".submit-on-change",this.submitOnChangeHandler);},t.prototype.submitOnChangeHandler=function(t){t&&t.preventDefault(),$(this).parents("form").submit();},t.prototype.setValueOnClick=function(t){void 0===t&&(t="body"),$(t).on("click",".click-select[data-target][data-value]",this.setValueOnClickHandler);},t.prototype.setValueOnClickHandler=function(){var t=$(this),e="#"+t.data("target");$(e).val(t.data("value")),$(e).trigger("change"),$('.click-select.clean[data-target="'+t.data("target")+'"]').each((function(){$(this).removeClass("active");})),$('.click-select.clean[data-target="'+t.data("target")+'"][data-value="'+t.data("value")+'"]').each((function(){$(this).addClass("active");}));},t}();var Uploader=function(){function e(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$(".image-uploader").each(this.singleImage),$(".gallery-uploader").each(this.gallery));}return e.prototype.refreshImage=function(e,r){$(e.data("preview")).css({"background-image":"url("+r.media.smallUrl+")"}),$(e.data("preview")).find("img").attr("src",r.media.smallUrl);},e.prototype.singleImage=function(){var e="#"+$(this).attr("id"),r=$(e),a="#"+$(this).attr("json"),l=null;r.dropzone({url:r.data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:r.data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e,init:function(){l=this;}}),l.on("addedfile",(function(){})),l.on("totaluploadprogress",(function(r){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:r+"%"});})),l.on("sending",(function(a){$(".upload-progress-bar."+e.replace("#","")).show(),$(r.data("preview")).addClass("loading");})),l.on("queuecomplete",(function(r){$(".upload-progress-bar."+e.replace("#","")).hide();})),l.on("success",(function(e,o){o.success?(o.media&&($(a).val(JSON.stringify(o.media)),$(r.data("preview")).css({"background-image":"url("+o.media.smallUrl+")"}),$(r.data("preview")).find("img").attr("src",o.media.smallUrl)),Alerts.success("New image added!")):Alerts.error("There was a problem adding the image: "+o.error),l.removeFile(e),$(r.data("preview")).removeClass("loading");}));},e.prototype.gallery=function(){var e="#"+$(this).attr("id"),r=$(e),a=document.querySelector(e+"-template");a.id="";var l=a.parentNode.innerHTML;a.parentNode.removeChild(a);var o=null;r.dropzone({url:r.data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:l,paramName:"files",acceptedFiles:r.data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",init:function(){o=this;}}),$(e+" .cancel").hide(),o.on("addedfile",(function(r){$(r.previewElement.querySelector(".complete")).hide(),$(r.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show();})),o.on("totaluploadprogress",(function(e,r,a){document.querySelector("#total-progress .progress-bar").style.width=e+"%";})),o.on("sending",(function(e){document.querySelector("#total-progress").style.opacity="1";})),o.on("complete",(function(e){$(e.previewElement.querySelector(".cancel")).hide(),$(e.previewElement.querySelector(".progress")).hide(),$(e.previewElement.querySelector(".complete")).show(),console.error("Uploader.Gallery.Dropzone.OnComplete - Inline.Refresh('.gallery') is not implemented.");})),o.on("queuecomplete",(function(r){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide();})),o.on("success",(function(e,r){console.error("Uploader.Gallery.Dropzone.OnSuccess - Inline.Refresh('.gallery') is not implemented."),r.success?Alerts.success("New images added!"):Alerts.error("There was a problem adding the profile image: "+r.error);})),$(".actions .cancel").click((function(){o.removeAllFiles(!0);}));},e}();var HoodApi=function(){function t(){this.alerts=new Alerts,this.handlers=new Handlers,this.uploader=new Uploader;}return t.prototype.initialise=function(){this.setupLoaders(),this.handlers.initDefaultHandlers(),this.initContactForms();},t.prototype.setupLoaders=function(){$("body").on("loader-show",(function(){document.body.classList.add("loading");})),$("body").on("loader-hide",(function(){document.body.classList.remove("loading");}));},t.prototype.initGoogleMaps=function(t){void 0===t&&(t=".google-map"),$(t).each((function(){var t=new google.maps.LatLng($(this).data("lat"),$(this).data("long"));console.log("Loading map at: "+$(this).data("lat")+", "+$(this).data("long"));var o=new google.maps.Map(this,{zoom:$(this).data("zoom")||15,center:t,scrollwheel:!1});new google.maps.Marker({position:t,map:o,title:$(this).data("marker")});$(window).on("resize",(function(){google.maps.event.trigger(o,"resize");})),google.maps.event.trigger(o,"resize");}));},t.prototype.initContactForms=function(t){void 0===t&&(t=".contact-form");var o=$(t);o.find(".thank-you").hide(),o.find(".form-content").show();var e=$(t)[0];new Validator(e,{onComplete:function(t){t.success?(o.attr("data-redirect")&&(window.location.href=o.attr("data-redirect")),o.attr("data-alert-message")&&Alerts.success(o.attr("data-alert-message")),o.find(".form").hide(),o.find(".thank-you").show()):o.attr("data-alert-error")?Alerts.error(o.attr("data-alert-error")):(console.error(t.errors),Alerts.error("There are errors on the form, please check your answers and try again."));}.bind(this)});},t}();var Loader=function(){function e(){new CustomEvent("loader-show"),new CustomEvent("loader-hide");}return e.show=function(){$("body").trigger("loader-show");},e.hide=function(){$("body").trigger("loader-hide");},e}();new Loader;$.fn.exists=function(){return $(this).length},$.fn.restrictToSlug=function(t){void 0===t&&(t=/[^0-9a-zA-Z]*/g);var n=$(this),e=function(){var n=$(this).val(),e=n.replace(t,"");n!==e&&$(this).val(e);};n.on("keyup",e),n.on("paste",e),n.on("change",e);},$.fn.restrictToPageSlug=function(t){void 0===t&&(t=/[^0-9a-zA-Z-//]*/g);var n=$(this),e=function(){var n=$(this).val(),e=n.replace(t,"");if((e.match(new RegExp("/","g"))||[]).length>4){var a=e.lastIndexOf("/");e=e.substring(0,a)+e.substring(a+1),Alerts.warning("You can only have up to 4 '/' characters in a url slug.");}n!==e&&$(this).val(e);};n.on("keyup",e),n.on("paste",e),n.on("change",e);},$.fn.restrictToMetaSlug=function(t){void 0===t&&(t=/[^0-9a-zA-Z.]*/g);var n=$(this),e=function(){var n=$(this).val(),e=n.replace(t,"");if((e.match(new RegExp(".","g"))||[]).length>1){var a=e.lastIndexOf(".");e=e.substring(0,a)+e.substring(a+1),Alerts.warning("You can only have up to 1 '.' characters in a meta slug.");}n!==e&&$(this).val(e);};n.on("keyup",e),n.on("paste",e),n.on("change",e);},$.fn.characterCounter=function(){var t=$(this),n=function(){var t=$(this).data("counter"),n=Number($(this).attr("maxlength")),e=$(this).val().length;$(t).text(n-e);var a="text-success";n-e<n/10&&(a="text-danger"),$(t).parent().removeClass("text-success").removeClass("text-danger").addClass(a);};t.on("keyup",n),t.on("paste",n),t.on("change",n);},$.fn.warningAlert=function(){$(this).on("click",(function(t){t.preventDefault();return Alerts.confirm({title:$(t.currentTarget).data("title"),html:$(t.currentTarget).data("warning"),footer:$(t.currentTarget).data("footer"),icon:"warning"},(function(n){if(n.isConfirmed){var e=$(t.currentTarget).attr("href");window.location.href=e;}})),!1}));};
23
- Number.prototype.formatCurrency=function(t){return t+" "+this.toFixed(2).replace(/./g,(function(t,e,r){return e>0&&"."!==t&&(r.length-e)%3==0?","+t:t}))},Number.prototype.formatKilobytes=function(){return (this/1024).toFixed(0).replace(/./g,(function(t,e,r){return e>0&&"."!==t&&(r.length-e)%3==0?","+t:t}))+"Kb"},Number.prototype.formatMegabytes=function(){var t=this/1024;return (t/=1024).toFixed(0).replace(/./g,(function(t,e,r){return e>0&&"."!==t&&(r.length-e)%3==0?","+t:t}))+"Mb"};String.prototype.htmlEncode=function(){return $("<div/>").text(this).html()},String.prototype.htmlDecode=function(){return $("<div/>").html(this).text()},String.prototype.contains=function(t){return -1!==this.indexOf(t)},String.prototype.pick=function(t,r){var o,n="";o=void 0===r?t:t+Math.floor(Math.random()*(r-t));for(var e=0;e<o;e++)n+=this.charAt(Math.floor(Math.random()*this.length));return n},String.prototype.shuffle=function(){var t,r,o=this.split(""),n=o.length;if(n)for(;--n;)t=o[r=Math.floor(Math.random()*(n+1))],o[r]=o[n],o[n]=t;return o.join("")},String.prototype.toSeoUrl=function(){var t=this.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase();"-"===t.charAt(0)&&(t=t.substring(1));var r=t.length-1;return "-"===t.charAt(r)&&(t=t.substring(0,r)),t};var PropertyService=function(){function t(t){this.options={listElementId:"property-list",mapListElementId:"property-map-list",mapElementId:"property-map"},this.map=null,this.center={lat:30,lng:-110},this.options=__assign(__assign({},this.options),t),this.initList();}return t.prototype.initList=function(){this.element=document.getElementById(this.options.listElementId),this.element&&(this.list=new DataList(this.element,{onLoad:function(t){void 0===t&&(t=null),this.options.onListLoad&&this.options.onListLoad(t);}.bind(this),onComplete:function(t,i){void 0===i&&(i=null),this.options.onListRender&&this.options.onListRender(t,i),Alerts.log("Finished loading property list.","info");}.bind(this)}));},t.prototype.initMapList=function(){this.mapListElement=document.getElementById(this.options.mapListElementId),this.mapElement&&(this.mapList=new DataList(this.mapListElement,{onComplete:function(t,i){void 0===i&&(i=null),this.options.onMapLoad&&this.options.onMapLoad(t,i),Alerts.log("Finished loading map list.","info"),this.reloadMarkers();}.bind(this)}));},t.prototype.initMap=function(){this.mapElement=document.getElementById(this.options.mapElementId),this.mapElement&&(this.center={lat:+this.mapElement.dataset.lat,lng:+this.mapElement.dataset.long},this.map=new google.maps.Map(this.mapElement,{zoom:+this.mapElement.dataset.zoom||15,center:this.center,scrollwheel:!1}),$(window).resize(function(){google.maps.event.trigger(this.map,"resize");}.bind(this)),google.maps.event.trigger(this.map,"resize"),this.initMapList());},t.prototype.reloadMarkers=function(){var t=null;if(this.mapElement){var i=this.map;if(this.markers)for(var e=0;e<this.markers.length;e++)this.markers[e].setMap(null);this.markers=[],$("#property-map-locations").data("locations").map(function(e,n){var o=new google.maps.Marker({position:new google.maps.LatLng(+e.Latitude,+e.Longitude),map:this.map,optimized:!0});this.mapElement.dataset.marker&&o.setIcon(this.mapElement.dataset.marker),o.info='<div class="card border-0" style="max-width:300px">\n <div style="background-image:url('.concat(e.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(e.Address1,", ").concat(e.Postcode,"</strong>\n </p>\n <p>").concat(e.Description,'</p>\n <a href="').concat(e.MarkerUrl,'" class="btn btn-block btn-primary">Find out more...</a>\n </div>\n</div>'),o.addListener("click",(function(){t&&t.close(),(t=new google.maps.InfoWindow({content:o.info})).open({anchor:o,map:i,shouldFocus:!1});})),this.markers.push(o);}.bind(this)),this.options.onMapRender&&this.options.onMapRender();}},t}();var App=function(r){function e(){var e=r.call(this)||this;return e.initialise(),e.property=new PropertyService,e}return __extends(e,r),e}(HoodApi);window.hood=new App;exports.App=App;Object.defineProperty(exports,'__esModule',{value:true});}));
23
+ Number.prototype.formatCurrency=function(t){return t+" "+this.toFixed(2).replace(/./g,(function(t,e,r){return e>0&&"."!==t&&(r.length-e)%3==0?","+t:t}))},Number.prototype.formatKilobytes=function(){return (this/1024).toFixed(0).replace(/./g,(function(t,e,r){return e>0&&"."!==t&&(r.length-e)%3==0?","+t:t}))+"Kb"},Number.prototype.formatMegabytes=function(){var t=this/1024;return (t/=1024).toFixed(0).replace(/./g,(function(t,e,r){return e>0&&"."!==t&&(r.length-e)%3==0?","+t:t}))+"Mb"};String.prototype.htmlEncode=function(){return $("<div/>").text(this).html()},String.prototype.htmlDecode=function(){return $("<div/>").html(this).text()},String.prototype.contains=function(t){return -1!==this.indexOf(t)},String.prototype.pick=function(t,r){var o,n="";o=void 0===r?t:t+Math.floor(Math.random()*(r-t));for(var e=0;e<o;e++)n+=this.charAt(Math.floor(Math.random()*this.length));return n},String.prototype.shuffle=function(){var t,r,o=this.split(""),n=o.length;if(n)for(;--n;)t=o[r=Math.floor(Math.random()*(n+1))],o[r]=o[n],o[n]=t;return o.join("")},String.prototype.toSeoUrl=function(){var t=this.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase();"-"===t.charAt(0)&&(t=t.substring(1));var r=t.length-1;return "-"===t.charAt(r)&&(t=t.substring(0,r)),t};var PropertyService=function(){function t(t){this.options={listElementId:"property-list",mapListElementId:"property-map-list",mapElementId:"property-map",mapLocationListId:"property-map-locations",renderPropertyPopup:function(t){return '<div class="card border-0" style="max-width:300px">\n <div style="background-image:url('.concat(t.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(t.Address1,", ").concat(t.Postcode,"</strong>\n </p>\n <p>").concat(t.Description,'</p>\n <a href="').concat(t.MarkerUrl,'" class="btn btn-block btn-primary">Find out more...</a>\n </div>\n </div>')}},this.map=null,this.center={lat:30,lng:-110},this.options=__assign(__assign({},this.options),t),this.initList();}return t.prototype.initList=function(){this.element=document.getElementById(this.options.listElementId),this.element&&(this.list=new DataList(this.element,{onLoad:function(t){void 0===t&&(t=null),this.options.onListLoad&&this.options.onListLoad(t);}.bind(this),onComplete:function(t,e){void 0===e&&(e=null),this.options.onListRender&&this.options.onListRender(t,e),Alerts.log("Finished loading property list.","info");}.bind(this)}));},t.prototype.initMapList=function(){this.mapListElement=document.getElementById(this.options.mapListElementId),this.mapElement&&(this.mapList=new DataList(this.mapListElement,{onComplete:function(t,e){void 0===e&&(e=null),this.options.onMapLoad&&this.options.onMapLoad(t,e),Alerts.log("Finished loading map list.","info"),this.reloadMarkers();}.bind(this)}));},t.prototype.initMap=function(){if(this.mapElement=document.getElementById(this.options.mapElementId),this.mapElement){this.center={lat:+this.mapElement.dataset.lat,lng:+this.mapElement.dataset.long};var t=!1;"true"===this.mapElement.dataset.scrollwheel&&(t=!0),this.map=new google.maps.Map(this.mapElement,{zoom:+this.mapElement.dataset.zoom||15,center:this.center,scrollwheel:t}),$(window).resize(function(){google.maps.event.trigger(this.map,"resize");}.bind(this)),google.maps.event.trigger(this.map,"resize"),this.initMapList();}},t.prototype.reloadMarkers=function(){var t=null;if(this.mapElement){var e=this.map;if(this.markers)for(var i=0;i<this.markers.length;i++)this.markers[i].setMap(null);this.markers=[];var n=document.getElementById(this.options.mapLocationListId);if(n)JSON.parse(n.dataset.locations).map(function(i,n){var o=new google.maps.Marker({position:new google.maps.LatLng(+i.Latitude,+i.Longitude),map:this.map,optimized:!0});this.mapElement.dataset.marker&&o.setIcon(this.mapElement.dataset.marker),o.info=this.options.renderPropertyPopup(i),o.addListener("click",(function(){t&&t.close(),(t=new google.maps.InfoWindow({content:o.info})).open({anchor:o,map:e,shouldFocus:!1});})),this.markers.push(o);}.bind(this)),this.options.onMapRender&&this.options.onMapRender();}},t}();var App=function(r){function e(){var e=r.call(this)||this;return e.initialise(),e.property=new PropertyService,e}return __extends(e,r),e}(HoodApi);window.hood=new App;exports.App=App;Object.defineProperty(exports,'__esModule',{value:true});}));
24
24
  if (typeof this !== 'undefined' && this.hood){ this.hoodCMS = this.Hood = this.hoodCMS = this.HoodCMS = this.hood }
package/dist/js/login.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.6
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hoodcms",
3
- "version": "6.0.6",
3
+ "version": "6.0.7",
4
4
  "description": "A fully customisable content management system built in ASP.NET Core 5 & Bootstrap 5.",
5
5
  "keywords": [
6
6
  "hood",
package/src/js/admin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.6
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.
package/src/js/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.6
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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.6
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,