hoodcms 6.0.0 → 6.0.1

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.
Files changed (39) hide show
  1. package/dist/js/admin/ContentController.d.ts +30 -0
  2. package/dist/js/admin/ContentController.js +188 -0
  3. package/dist/js/admin/ContentTypeController.d.ts +15 -0
  4. package/dist/js/admin/ContentTypeController.js +140 -0
  5. package/dist/js/admin/HomeController.d.ts +17 -0
  6. package/dist/js/admin/HomeController.js +111 -0
  7. package/dist/js/admin/LogsController.d.ts +6 -0
  8. package/dist/js/admin/LogsController.js +14 -0
  9. package/dist/js/admin/MediaController.d.ts +7 -0
  10. package/dist/js/admin/MediaController.js +29 -0
  11. package/dist/js/admin/PropertyController.d.ts +18 -0
  12. package/dist/js/admin/PropertyController.js +118 -0
  13. package/dist/js/admin/PropertyImporter.d.ts +31 -0
  14. package/dist/js/admin/PropertyImporter.js +95 -0
  15. package/dist/js/admin/ThemesController.d.ts +8 -0
  16. package/dist/js/admin/ThemesController.js +37 -0
  17. package/dist/js/admin/UsersController.d.ts +17 -0
  18. package/dist/js/admin/UsersController.js +176 -0
  19. package/dist/js/admin.js +4 -4
  20. package/dist/js/app/PropertyService.d.ts +46 -0
  21. package/{src/ts/app/PropertyController.ts → dist/js/app/PropertyService.js} +44 -76
  22. package/dist/js/app.js +16 -4
  23. package/dist/js/app.property.js +5 -5
  24. package/dist/js/core/DataList.js +25 -3
  25. package/dist/js/index.d.ts +10 -0
  26. package/dist/js/index.js +12 -0
  27. package/dist/js/login.js +1 -1
  28. package/package.json +7 -7
  29. package/src/js/admin.js +491 -469
  30. package/src/js/admin.js.map +1 -1
  31. package/src/js/app.js +11546 -5
  32. package/src/js/app.js.map +1 -1
  33. package/src/js/app.property.js +175 -129
  34. package/src/js/app.property.js.map +1 -1
  35. package/src/js/login.js +1 -1
  36. package/src/ts/app/PropertyService.ts +202 -0
  37. package/src/ts/app.property.ts +4 -5
  38. package/src/ts/core/DataList.ts +27 -4
  39. package/src/ts/index.ts +14 -0
@@ -1,18 +1,18 @@
1
1
  /*!
2
- * hoodcms v6.0.0
2
+ * hoodcms v6.0.1
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.
6
6
  */
7
7
  (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('@simonwep/pickr'), require('tinymce/tinymce'), require('bootstrap')) :
9
- typeof define === 'function' && define.amd ? define(['exports', 'sweetalert2', '@simonwep/pickr', 'tinymce/tinymce', 'bootstrap'], factory) :
10
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.hood = {}, global.Swal));
11
- })(this, (function (exports, Swal) { 'use strict';
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('@simonwep/pickr'), require('tinymce/tinymce'), require('bootstrap'), require('chart.js')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', 'sweetalert2', '@simonwep/pickr', 'tinymce/tinymce', 'bootstrap', 'chart.js'], factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.hood = {}, global.swal));
11
+ })(this, (function (exports, swal) { 'use strict';
12
12
 
13
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
14
 
15
- var Swal__default = /*#__PURE__*/_interopDefaultLegacy(Swal);
15
+ var swal__default = /*#__PURE__*/_interopDefaultLegacy(swal);
16
16
 
17
17
  /*! *****************************************************************************
18
18
  Copyright (c) Microsoft Corporation.
@@ -56,7 +56,7 @@
56
56
 
57
57
  "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),this.options.bgColor!==!1&&this._toastEl.css("background-color",this.options.bgColor),this.options.textColor!==!1&&this._toastEl.css("color",this.options.textColor),this.options.textAlign&&this._toastEl.css("text-align",this.options.textAlign),this.options.icon!==!1&&(this._toastEl.addClass("jq-has-icon"),-1!==t.inArray(this.options.icon,this._defaultIcons)&&this._toastEl.addClass("jq-icon-"+this.options.icon)),this.options["class"]!==!1&&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,s=i-this.options.stack;s>0&&t(".jq-toast-wrap").find(".jq-toast-single").slice(0,s).remove();}this._container=o;},canAutoHide:function(){return this.options.hideAfter!==!1&&!isNaN(parseInt(this.options.hideAfter,10))},processLoader:function(){if(!this.canAutoHide()||this.options.loader===!1)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()){var 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);
58
58
 
59
- var BootstrapSwal = Swal__default["default"].mixin({
59
+ var BootstrapSwal = swal__default["default"].mixin({
60
60
  customClass: {
61
61
  confirmButton: 'btn btn-success m-1 px-3',
62
62
  cancelButton: 'btn btn-danger m-1 px-3'
@@ -318,9 +318,31 @@
318
318
  }
319
319
  this.options = __assign(__assign({}, this.options), options);
320
320
  if ($(this.element).hasClass('query')) {
321
- var pageUrl = $(this.element).data('url') + window.location.search;
322
- $(this.element).attr('data-url', pageUrl);
323
- $(this.element).data('url', pageUrl);
321
+ var r = new RegExp('^(?:[a-z]+:)?//', 'i');
322
+ var pageUrl = null;
323
+ if (r.test(this.element.dataset.url)) {
324
+ pageUrl = new URL(this.element.dataset.url);
325
+ }
326
+ else {
327
+ pageUrl = new URL(window.location.origin + this.element.dataset.url);
328
+ }
329
+ if ('URLSearchParams' in window) {
330
+ var searchParams = new URLSearchParams(window.location.search);
331
+ var urlParams = new URLSearchParams(pageUrl.search);
332
+ searchParams.forEach(function (value, key, parent) {
333
+ urlParams.set(key, value);
334
+ });
335
+ if (urlParams.get("page") == "0") {
336
+ urlParams.set("page", "1");
337
+ }
338
+ pageUrl.search = urlParams.toString();
339
+ }
340
+ else {
341
+ pageUrl.search = window.location.search;
342
+ }
343
+ var url = pageUrl.pathname + pageUrl.search;
344
+ $(this.element).attr('data-url', url);
345
+ $(this.element).data('url', url);
324
346
  }
325
347
  if (!$(this.element).hasClass('refresh-only')) {
326
348
  var listUrl = document.createElement('a');
@@ -608,21 +630,6 @@
608
630
  return Handlers;
609
631
  }());
610
632
 
611
- var Loader = /** @class */ (function () {
612
- function Loader() {
613
- new CustomEvent('loader-show');
614
- new CustomEvent('loader-hide');
615
- }
616
- Loader.show = function () {
617
- $('body').trigger('loader-show');
618
- };
619
- Loader.hide = function () {
620
- $('body').trigger('loader-hide');
621
- };
622
- return Loader;
623
- }());
624
- new Loader();
625
-
626
633
  var Uploader = /** @class */ (function () {
627
634
  function Uploader() {
628
635
  if ($('.image-uploader').length || $('.gallery-uploader').length) {
@@ -758,6 +765,104 @@
758
765
  return Uploader;
759
766
  }());
760
767
 
768
+ /// <reference types="google.maps" />
769
+ /**
770
+ * Base class for extending a Hood CMS website, ensure you call HoodApi.initialise() to setup loaders and contact form defaults.
771
+ */
772
+ var HoodApi = /** @class */ (function () {
773
+ function HoodApi() {
774
+ this.alerts = new Alerts();
775
+ this.handlers = new Handlers();
776
+ this.uploader = new Uploader();
777
+ }
778
+ // Initialise Hood CMS site defaults, can be overridden or individual setup items can be called instead of the initialise function.
779
+ HoodApi.prototype.initialise = function () {
780
+ // Initialise loaders (default, adds loading to body tag)
781
+ this.setupLoaders();
782
+ // Hook up default handlers.
783
+ this.handlers.initDefaultHandlers();
784
+ // Init hood contact forms.
785
+ this.initContactForms();
786
+ };
787
+ /**
788
+ * Default Hood CMS loaders, can be used however, this simply adds a "loading" class to the body tag on show/hide.
789
+ */
790
+ HoodApi.prototype.setupLoaders = function () {
791
+ $('body').on('loader-show', function () { document.body.classList.add('loading'); });
792
+ $('body').on('loader-hide', function () { document.body.classList.remove('loading'); });
793
+ };
794
+ /**
795
+ * Default initialisation function for Google Maps, should be called as the callback from the Google Maps API script tag.
796
+ */
797
+ HoodApi.prototype.initGoogleMaps = function (tag) {
798
+ if (tag === void 0) { tag = '.google-map'; }
799
+ $(tag).each(function () {
800
+ var myLatLng = new google.maps.LatLng($(this).data('lat'), $(this).data('long'));
801
+ console.log('Loading map at: ' + $(this).data('lat') + ', ' + $(this).data('long'));
802
+ var map = new google.maps.Map(this, {
803
+ zoom: $(this).data('zoom') || 15,
804
+ center: myLatLng,
805
+ scrollwheel: false
806
+ });
807
+ new google.maps.Marker({
808
+ position: myLatLng,
809
+ map: map,
810
+ title: $(this).data('marker')
811
+ });
812
+ $(window).on('resize', function () {
813
+ google.maps.event.trigger(map, 'resize');
814
+ });
815
+ google.maps.event.trigger(map, 'resize');
816
+ });
817
+ };
818
+ /**
819
+ * Initialisation function for contact forms on the site, will add validator, and submit/functionality to any forms matching the given tag selector string.
820
+ */
821
+ HoodApi.prototype.initContactForms = function (tag) {
822
+ if (tag === void 0) { tag = '.contact-form'; }
823
+ var $form = $(tag);
824
+ $form.find('.thank-you').hide();
825
+ $form.find('.form-content').show();
826
+ var form = $(tag)[0];
827
+ new Validator(form, {
828
+ onComplete: function (response) {
829
+ if (response.success) {
830
+ if ($form.attr('data-redirect'))
831
+ window.location.href = $form.attr('data-redirect');
832
+ if ($form.attr('data-alert-message'))
833
+ Alerts.success($form.attr('data-alert-message'));
834
+ $form.find('.form').hide();
835
+ $form.find('.thank-you').show();
836
+ }
837
+ else {
838
+ if ($form.attr('data-alert-error'))
839
+ Alerts.error($form.attr('data-alert-error'));
840
+ else {
841
+ console.error(response.errors);
842
+ Alerts.error("There are errors on the form, please check your answers and try again.");
843
+ }
844
+ }
845
+ }.bind(this)
846
+ });
847
+ };
848
+ return HoodApi;
849
+ }());
850
+
851
+ var Loader = /** @class */ (function () {
852
+ function Loader() {
853
+ new CustomEvent('loader-show');
854
+ new CustomEvent('loader-hide');
855
+ }
856
+ Loader.show = function () {
857
+ $('body').trigger('loader-show');
858
+ };
859
+ Loader.hide = function () {
860
+ $('body').trigger('loader-hide');
861
+ };
862
+ return Loader;
863
+ }());
864
+ new Loader();
865
+
761
866
  $.fn.exists = function () {
762
867
  return $(this).length;
763
868
  };
@@ -929,121 +1034,57 @@
929
1034
  };
930
1035
 
931
1036
  /// <reference types="google.maps" />
932
- /**
933
- * Base class for extending a Hood CMS website, ensure you call HoodApi.initialise() to setup loaders and contact form defaults.
934
- */
935
- var HoodApi = /** @class */ (function () {
936
- function HoodApi() {
937
- this.alerts = new Alerts();
938
- this.handlers = new Handlers();
939
- this.uploader = new Uploader();
940
- }
941
- // Initialise Hood CMS site defaults, can be overridden or individual setup items can be called instead of the initialise function.
942
- HoodApi.prototype.initialise = function () {
943
- // Initialise loaders (default, adds loading to body tag)
944
- this.setupLoaders();
945
- // Hook up default handlers.
946
- this.handlers.initDefaultHandlers();
947
- // Init hood contact forms.
948
- this.initContactForms();
949
- };
950
- /**
951
- * Default Hood CMS loaders, can be used however, this simply adds a "loading" class to the body tag on show/hide.
952
- */
953
- HoodApi.prototype.setupLoaders = function () {
954
- $('body').on('loader-show', function () { document.body.classList.add('loading'); });
955
- $('body').on('loader-hide', function () { document.body.classList.remove('loading'); });
956
- };
957
- /**
958
- * Default initialisation function for Google Maps, should be called as the callback from the Google Maps API script tag.
959
- */
960
- HoodApi.prototype.initGoogleMaps = function (tag) {
961
- if (tag === void 0) { tag = '.google-map'; }
962
- $(tag).each(function () {
963
- var myLatLng = new google.maps.LatLng($(this).data('lat'), $(this).data('long'));
964
- console.log('Loading map at: ' + $(this).data('lat') + ', ' + $(this).data('long'));
965
- var map = new google.maps.Map(this, {
966
- zoom: $(this).data('zoom') || 15,
967
- center: myLatLng,
968
- scrollwheel: false
969
- });
970
- new google.maps.Marker({
971
- position: myLatLng,
972
- map: map,
973
- title: $(this).data('marker')
974
- });
975
- $(window).on('resize', function () {
976
- google.maps.event.trigger(map, 'resize');
977
- });
978
- google.maps.event.trigger(map, 'resize');
979
- });
980
- };
981
- /**
982
- * Initialisation function for contact forms on the site, will add validator, and submit/functionality to any forms matching the given tag selector string.
983
- */
984
- HoodApi.prototype.initContactForms = function (tag) {
985
- if (tag === void 0) { tag = '.contact-form'; }
986
- var $form = $(tag);
987
- $form.find('.thank-you').hide();
988
- $form.find('.form-content').show();
989
- var form = $(tag)[0];
990
- new Validator(form, {
991
- onComplete: function (response) {
992
- if (response.success) {
993
- if ($form.attr('data-redirect'))
994
- window.location.href = $form.attr('data-redirect');
995
- if ($form.attr('data-alert-message'))
996
- Alerts.success($form.attr('data-alert-message'));
997
- $form.find('.form').hide();
998
- $form.find('.thank-you').show();
999
- }
1000
- else {
1001
- if ($form.attr('data-alert-error'))
1002
- Alerts.error($form.attr('data-alert-error'));
1003
- else {
1004
- console.error(response.errors);
1005
- Alerts.error("There are errors on the form, please check your answers and try again.");
1006
- }
1007
- }
1008
- }.bind(this)
1009
- });
1010
- };
1011
- return HoodApi;
1012
- }());
1013
-
1014
- /// <reference types="google.maps" />
1015
- var PropertyController = /** @class */ (function () {
1016
- function PropertyController() {
1037
+ var PropertyService = /** @class */ (function () {
1038
+ function PropertyService(options) {
1039
+ this.options = {
1040
+ listElementId: 'property-list',
1041
+ mapListElementId: 'property-map-list',
1042
+ mapElementId: 'property-map'
1043
+ };
1017
1044
  this.map = null;
1018
1045
  this.center = { lat: 30, lng: -110 };
1046
+ this.options = __assign(__assign({}, this.options), options);
1019
1047
  this.initList();
1020
1048
  }
1021
- PropertyController.prototype.initList = function () {
1022
- this.element = document.getElementById('property-list');
1049
+ PropertyService.prototype.initList = function () {
1050
+ this.element = document.getElementById(this.options.listElementId);
1023
1051
  if (!this.element) {
1024
1052
  return;
1025
1053
  }
1026
1054
  this.list = new DataList(this.element, {
1055
+ onLoad: function (sender) {
1056
+ if (sender === void 0) { sender = null; }
1057
+ if (this.options.onListLoad) {
1058
+ this.options.onListLoad(sender);
1059
+ }
1060
+ }.bind(this),
1027
1061
  onComplete: function (data, sender) {
1062
+ if (sender === void 0) { sender = null; }
1063
+ if (this.options.onListRender) {
1064
+ this.options.onListRender(data, sender);
1065
+ }
1028
1066
  Alerts.log('Finished loading property list.', 'info');
1029
1067
  }.bind(this)
1030
1068
  });
1031
1069
  };
1032
- PropertyController.prototype.initMapList = function () {
1033
- this.mapListElement = document.getElementById('property-map-list');
1070
+ PropertyService.prototype.initMapList = function () {
1071
+ this.mapListElement = document.getElementById(this.options.mapListElementId);
1034
1072
  if (!this.mapElement) {
1035
1073
  return;
1036
1074
  }
1037
1075
  this.mapList = new DataList(this.mapListElement, {
1038
1076
  onComplete: function (data, sender) {
1077
+ if (sender === void 0) { sender = null; }
1078
+ if (this.options.onMapLoad) {
1079
+ this.options.onMapLoad(data, sender);
1080
+ }
1039
1081
  Alerts.log('Finished loading map list.', 'info');
1040
1082
  this.reloadMarkers();
1041
1083
  }.bind(this)
1042
1084
  });
1043
1085
  };
1044
- PropertyController.prototype.initMap = function (mapElementId) {
1045
- if (mapElementId === void 0) { mapElementId = 'property-map'; }
1046
- this.mapElement = document.getElementById(mapElementId);
1086
+ PropertyService.prototype.initMap = function () {
1087
+ this.mapElement = document.getElementById(this.options.mapElementId);
1047
1088
  if (!this.mapElement) {
1048
1089
  return;
1049
1090
  }
@@ -1059,7 +1100,7 @@
1059
1100
  google.maps.event.trigger(this.map, 'resize');
1060
1101
  this.initMapList();
1061
1102
  };
1062
- PropertyController.prototype.reloadMarkers = function () {
1103
+ PropertyService.prototype.reloadMarkers = function () {
1063
1104
  var infowindow = null;
1064
1105
  if (!this.mapElement) {
1065
1106
  return;
@@ -1078,25 +1119,30 @@
1078
1119
  map: this.map,
1079
1120
  optimized: true // makes SVG icons work in IE
1080
1121
  });
1081
- //marker.setIcon({
1082
- // url: '/images/marker.png',
1083
- // size: new google.maps.Size(30, 41),
1084
- // scaledSize: new google.maps.Size(30, 41)
1085
- //});
1122
+ if (this.mapElement.dataset.marker) {
1123
+ marker.setIcon(this.mapElement.dataset.marker);
1124
+ }
1086
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>");
1087
- google.maps.event.addListener(marker, 'click', function () {
1126
+ marker.addListener("click", function () {
1088
1127
  if (infowindow) {
1089
1128
  infowindow.close();
1090
1129
  }
1091
1130
  infowindow = new google.maps.InfoWindow({
1092
- content: this.info
1131
+ content: marker.info
1093
1132
  });
1094
- infowindow.open(map, this);
1095
- }.bind(this));
1133
+ infowindow.open({
1134
+ anchor: marker,
1135
+ map: map,
1136
+ shouldFocus: false,
1137
+ });
1138
+ });
1096
1139
  this.markers.push(marker);
1097
1140
  }.bind(this));
1141
+ if (this.options.onMapRender) {
1142
+ this.options.onMapRender();
1143
+ }
1098
1144
  };
1099
- return PropertyController;
1145
+ return PropertyService;
1100
1146
  }());
1101
1147
 
1102
1148
  /// <reference types="google.maps" />
@@ -1107,7 +1153,7 @@
1107
1153
  // Setup defaults with HoodApi default initialise function.
1108
1154
  _this.initialise();
1109
1155
  // Initialise the property controllers.
1110
- _this.property = new PropertyController();
1156
+ _this.property = new PropertyService();
1111
1157
  return _this;
1112
1158
  }
1113
1159
  return App;