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.
@@ -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.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hoodcms",
3
- "version": "6.0.4",
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",
@@ -50,28 +50,28 @@
50
50
  "@simonwep/pickr": "^1.8.2",
51
51
  "@types/bootstrap": "^5.1.9",
52
52
  "@types/dropzone": "^5.7.4",
53
- "@types/google.maps": "^3.47.4",
54
- "@types/jquery": "^3.5.13",
53
+ "@types/google.maps": "^3.48.1",
54
+ "@types/jquery": "^3.5.14",
55
55
  "@types/jquery-toast-plugin": "^1.3.3",
56
56
  "@types/jquery.slimscroll": "^1.3.31",
57
57
  "@types/jquery.validation": "^1.16.7",
58
58
  "bootstrap": "^5.1.3",
59
- "chart.js": "^3.7.0",
59
+ "chart.js": "^3.7.1",
60
60
  "dropzone": "^5.9.3",
61
61
  "jquery": "^3.6.0",
62
62
  "jquery-slimscroll": "^1.3.8",
63
63
  "jquery-toast-plugin": "^1.3.2",
64
64
  "jquery-validation": "^1.19.3",
65
- "sweetalert2": "^11.4.0",
65
+ "sweetalert2": "^11.4.4",
66
66
  "tinymce": "^5.10.3"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@lopatnov/rollup-plugin-uglify": "^2.1.2",
70
- "@rollup/plugin-commonjs": "^21.0.1",
70
+ "@rollup/plugin-commonjs": "^21.0.2",
71
71
  "@rollup/plugin-node-resolve": "^13.1.3",
72
- "@rollup/plugin-typescript": "^8.3.0",
72
+ "@rollup/plugin-typescript": "^8.3.1",
73
73
  "cssnano": "^5.0.17",
74
- "eslint": "^8.8.0",
74
+ "eslint": "^8.10.0",
75
75
  "gulp": "^4.0.2",
76
76
  "gulp-autoprefixer": "^8.0.0",
77
77
  "gulp-concat": "^2.6.1",
@@ -85,12 +85,12 @@
85
85
  "node-sass-tilde-importer": "^1.0.2",
86
86
  "npm-run-all": "^4.1.5",
87
87
  "npm-watch": "^0.11.0",
88
- "postcss": "^8.4.6",
89
- "rollup": "^2.67.1",
88
+ "postcss": "^8.4.7",
89
+ "rollup": "^2.68.0",
90
90
  "rollup-pluginutils": "^2.8.2",
91
- "sass": "^1.49.7",
92
- "stylelint": "^14.4.0",
93
- "terser": "^5.10.0",
91
+ "sass": "^1.49.9",
92
+ "stylelint": "^14.5.3",
93
+ "terser": "^5.11.0",
94
94
  "typescript": "^4.5.5"
95
95
  },
96
96
  "watch": {
package/src/js/admin.js CHANGED
@@ -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.
@@ -929,6 +929,72 @@
929
929
  }.bind(this));
930
930
  };
931
931
  return MediaService;
932
+ }());
933
+ var MediaModal = /** @class */ (function () {
934
+ function MediaModal() {
935
+ $('body').on('click', '[data-hood-media=attach],[data-hood-media=select],[data-hood-media=gallery]', this.load.bind(this));
936
+ $('body').on('click', '[data-hood-media=clear]', this.clear.bind(this));
937
+ $('[data-hood-media=gallery]').each(this.initGallery.bind(this));
938
+ }
939
+ MediaModal.prototype.initGallery = function (index, element) {
940
+ // setup the gallery list also, just a simple list jobby, and attach it to the
941
+ var el = document.getElementById(element.dataset.hoodMediaTarget);
942
+ if (el) {
943
+ new DataList(el, {
944
+ onComplete: function (data, sender) {
945
+ Alerts.log('Finished loading gallery media list.', 'info');
946
+ }.bind(this)
947
+ });
948
+ }
949
+ };
950
+ MediaModal.prototype.load = function (e) {
951
+ e.preventDefault();
952
+ e.stopPropagation();
953
+ this.element = e.currentTarget;
954
+ if (this.modal && this.modal.isOpen) {
955
+ return;
956
+ }
957
+ this.modal = new ModalController({
958
+ onComplete: function (sender) {
959
+ this.list = document.getElementById('media-list');
960
+ this.service = new MediaService(this.list, {
961
+ action: this.element.dataset.hoodMedia,
962
+ url: this.element.dataset.hoodMediaUrl,
963
+ refresh: this.element.dataset.hoodMediaRefresh,
964
+ target: this.element.dataset.hoodMediaTarget,
965
+ size: this.element.dataset.hoodMediaSize,
966
+ beforeAction: function (sender, mediaObject) {
967
+ }.bind(this),
968
+ onAction: function (sender, mediaObject) {
969
+ this.modal.close();
970
+ }.bind(this),
971
+ onListLoad: function (sender) {
972
+ },
973
+ onListRender: function (data) {
974
+ return data;
975
+ },
976
+ onListComplete: function (data) {
977
+ },
978
+ onError: function (jqXHR, textStatus, errorThrown) {
979
+ },
980
+ });
981
+ }.bind(this)
982
+ });
983
+ this.modal.show($(e.currentTarget).data('hood-media-list'), e.currentTarget);
984
+ };
985
+ MediaModal.prototype.clear = function (e) {
986
+ e.preventDefault();
987
+ e.stopPropagation();
988
+ Alerts.confirm({}, function (result) {
989
+ if (result.isConfirmed) {
990
+ Inline.post(e.currentTarget.href, e.currentTarget, function (response) {
991
+ Response.process(response, 5000);
992
+ MediaService.refresh(response.media, e.currentTarget.dataset.hoodMediaRefresh);
993
+ }.bind(this));
994
+ }
995
+ }.bind(this));
996
+ };
997
+ return MediaModal;
932
998
  }());
933
999
 
934
1000
  var Editors = /** @class */ (function () {
@@ -2557,6 +2623,7 @@
2557
2623
  var _this = _super.call(this) || this;
2558
2624
  _this.editors = new Editors();
2559
2625
  _this.colorPickers = new ColorPickers();
2626
+ _this.mediaModal = new MediaModal();
2560
2627
  // Hook up default handlers.
2561
2628
  _this.handlers.initDefaultHandlers();
2562
2629
  // Admin Controllers