From 57083572c047460b23a79749c9f66e87f8c0627e Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:27:20 +0100 Subject: [PATCH 01/12] Update RelationController.php --- modules/backend/behaviors/RelationController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index 609839fe50..aca384b1b9 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -675,12 +675,14 @@ protected function makeViewWidget() $config->noRecordsMessage = $this->getConfig('view[noRecordsMessage]'); $defaultOnClick = sprintf( - "$.wn.relationBehavior.clickViewListRecord(':%s', '%s', '%s')", + "$.wn.relationBehavior.clickViewListRecord(':%s', '%s', '%s', '%s', '%s')", $this->relationModel->getKeyName(), $this->relationGetId(), - $this->relationGetSessionKey() + $this->relationGetSessionKey(), + $config->size, + $config->cssClass ); - + if ($config->recordUrl) { $defaultOnClick = null; } From 72c623883a42092dabffa0cdc593a4b2c81d6e64 Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:29:09 +0100 Subject: [PATCH 02/12] Update popup.js --- modules/system/assets/ui/js/popup.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/system/assets/ui/js/popup.js b/modules/system/assets/ui/js/popup.js index c6b6b0ac0a..a52454dc0b 100644 --- a/modules/system/assets/ui/js/popup.js +++ b/modules/system/assets/ui/js/popup.js @@ -49,7 +49,8 @@ content: null, size: null, adaptiveHeight: false, - zIndex: null + zIndex: null, + cssClass: null } Popup.prototype.init = function(){ @@ -207,6 +208,9 @@ if (this.options.adaptiveHeight) modalDialog.addClass('adaptive-height') + if (this.options.cssClass) + modalDialog.addClass(this.options.cssClass) + if (this.options.zIndex !== null) modal.css('z-index', this.options.zIndex + 20) From b07857227a5b3319fa479212815bf47c753a87a2 Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:29:53 +0100 Subject: [PATCH 03/12] Update storm-min.js --- modules/system/assets/ui/storm-min.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/system/assets/ui/storm-min.js b/modules/system/assets/ui/storm-min.js index ba66b4d5f4..0f591ede9d 100644 --- a/modules/system/assets/ui/storm-min.js +++ b/modules/system/assets/ui/storm-min.js @@ -2153,7 +2153,7 @@ this.initEvents() this.init()} Popup.prototype=Object.create(BaseProto) Popup.prototype.constructor=Popup -Popup.DEFAULTS={ajax:null,handler:null,keyboard:true,extraData:{},content:null,size:null,adaptiveHeight:false,zIndex:null} +Popup.DEFAULTS={ajax:null,handler:null,keyboard:true,extraData:{},content:null,size:null,adaptiveHeight:false,zIndex:null,cssClass:null} Popup.prototype.init=function(){var self=this if(self.isOpen)return this.setBackdrop(true) @@ -2197,6 +2197,7 @@ BaseProto.dispose.call(this)} Popup.prototype.createPopupContainer=function(){var modal=$('
').prop({class:'control-popup modal fade',role:'dialog',tabindex:-1}),modalDialog=$('').addClass('modal-dialog'),modalContent=$('').addClass('modal-content') if(this.options.size)modalDialog.addClass('size-'+this.options.size) if(this.options.adaptiveHeight)modalDialog.addClass('adaptive-height') +if(this.options.cssClass)modalDialog.addClass(this.options.cssClass) if(this.options.zIndex!==null)modal.css('z-index',this.options.zIndex+20) return modal.append(modalDialog.append(modalContent))} Popup.prototype.setContent=function(contents){this.$content.html(contents) @@ -2814,7 +2815,7 @@ return this}}(window.jQuery);+function($){"use strict";var Tab=function(element, this.$tabsContainer=$('.nav-tabs:first',$el) this.$pagesContainer=$('.tab-content:first',$el) this.tabId='tabs'+$el.parents().length+Math.round(Math.random()*1000);if(this.options.closable!==undefined&&this.options.closable!==false)$el.attr('data-closable','') -this.init()} +var self=this;setTimeout(function(){self.init()},300)} Tab.prototype.init=function(){var self=this;this.options.slidable=this.options.slidable!==undefined&&this.options.slidable!==false $('> li',this.$tabsContainer).each(function(index){self.initTab(this)}) this.$el.on('close.oc.tab',function(ev,data){ev.preventDefault() @@ -4777,4 +4778,4 @@ data[option].apply(data,methodArguments)}}})} $.fn.listSortable.Constructor=ListSortable $.fn.listSortable.noConflict=function(){$.fn.listSortable=old return this} -$(document).render(function(){$('[data-control=list-sortable]').listSortable()})}(window.jQuery); \ No newline at end of file +$(document).render(function(){$('[data-control=list-sortable]').listSortable()})}(window.jQuery); From 21edb7f311befa4c46220ae366e4ab1029bd7e61 Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:30:29 +0100 Subject: [PATCH 04/12] Update winter.relation.js --- .../relationcontroller/assets/js/winter.relation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js b/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js index 5af54ebeed..5b3d1e9219 100644 --- a/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js +++ b/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js @@ -9,14 +9,15 @@ $(el).closest('.control-list').listWidget('toggleChecked', [el]) } - this.clickViewListRecord = function(recordId, relationId, sessionKey) { + this.clickViewListRecord = function(recordId, relationId, sessionKey, size = 'huge', cssClass = '') { var newPopup = $(''), $container = $('#'+relationId), requestData = paramToObj('data-request-data', $container.data('request-data')) newPopup.popup({ handler: 'onRelationClickViewList', - size: 'huge', + size: size, + cssClass: cssClass, extraData: $.extend({}, requestData, { 'manage_id': recordId, '_session_key': sessionKey From bde98dd98d30d6e868e4e639fdbdbb1da5085a9d Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:35:41 +0100 Subject: [PATCH 05/12] [fix] missing properties --- modules/backend/behaviors/RelationController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index aca384b1b9..e0b2e35f77 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -673,6 +673,8 @@ protected function makeViewWidget() $config->recordUrl = $this->getConfig('view[recordUrl]'); $config->customViewPath = $this->getConfig('view[customViewPath]'); $config->noRecordsMessage = $this->getConfig('view[noRecordsMessage]'); + $config->size = $this->getConfig('manage[size]'); + $config->cssClass = $this->getConfig('manage[cssClass]'); $defaultOnClick = sprintf( "$.wn.relationBehavior.clickViewListRecord(':%s', '%s', '%s', '%s', '%s')", From 4ec18a03d3a228f68561a3ffe136f2b13c17de12 Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:42:58 +0100 Subject: [PATCH 06/12] [fix] size is not filled in --- .../relationcontroller/assets/js/winter.relation.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js b/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js index 5b3d1e9219..3b9df4075d 100644 --- a/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js +++ b/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js @@ -9,11 +9,15 @@ $(el).closest('.control-list').listWidget('toggleChecked', [el]) } - this.clickViewListRecord = function(recordId, relationId, sessionKey, size = 'huge', cssClass = '') { + this.clickViewListRecord = function(recordId, relationId, sessionKey, size, cssClass) { var newPopup = $(''), $container = $('#'+relationId), requestData = paramToObj('data-request-data', $container.data('request-data')) + if (!size) { + size = 'huge' + } + newPopup.popup({ handler: 'onRelationClickViewList', size: size, From fc77e5b6003d8b3eb0d47880c257d3ca02705b57 Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:33:18 +0100 Subject: [PATCH 07/12] [add] allowDismiss --- modules/backend/behaviors/RelationController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index e0b2e35f77..15c3fdb315 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -675,16 +675,18 @@ protected function makeViewWidget() $config->noRecordsMessage = $this->getConfig('view[noRecordsMessage]'); $config->size = $this->getConfig('manage[size]'); $config->cssClass = $this->getConfig('manage[cssClass]'); + $config->allowDismiss = $this->getConfig('manage[allowDismiss]'); $defaultOnClick = sprintf( - "$.wn.relationBehavior.clickViewListRecord(':%s', '%s', '%s', '%s', '%s')", + "$.wn.relationBehavior.clickViewListRecord(':%s', '%s', '%s', '%s', '%s', '%s')", $this->relationModel->getKeyName(), $this->relationGetId(), $this->relationGetSessionKey(), $config->size, - $config->cssClass + $config->cssClass, + $config->allowDismiss ); - + if ($config->recordUrl) { $defaultOnClick = null; } From 137b71743ed986f8ec3a91f7c99460dde8c29dfd Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:33:35 +0100 Subject: [PATCH 08/12] [add] allowDismiss --- .../behaviors/relationcontroller/assets/js/winter.relation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js b/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js index 3b9df4075d..a2c9e076c4 100644 --- a/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js +++ b/modules/backend/behaviors/relationcontroller/assets/js/winter.relation.js @@ -9,7 +9,7 @@ $(el).closest('.control-list').listWidget('toggleChecked', [el]) } - this.clickViewListRecord = function(recordId, relationId, sessionKey, size, cssClass) { + this.clickViewListRecord = function(recordId, relationId, sessionKey, size, cssClass, allowDismiss) { var newPopup = $(''), $container = $('#'+relationId), requestData = paramToObj('data-request-data', $container.data('request-data')) @@ -22,6 +22,7 @@ handler: 'onRelationClickViewList', size: size, cssClass: cssClass, + allowDismiss: allowDismiss, extraData: $.extend({}, requestData, { 'manage_id': recordId, '_session_key': sessionKey From c296dbebf43be0f3d47b43bd9972457104007e1b Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:34:01 +0100 Subject: [PATCH 09/12] [add] allowDismiss --- modules/system/assets/ui/js/popup.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/system/assets/ui/js/popup.js b/modules/system/assets/ui/js/popup.js index a52454dc0b..bea65444b0 100644 --- a/modules/system/assets/ui/js/popup.js +++ b/modules/system/assets/ui/js/popup.js @@ -50,7 +50,8 @@ size: null, adaptiveHeight: false, zIndex: null, - cssClass: null + cssClass: null, + allowDismiss: false } Popup.prototype.init = function(){ @@ -213,6 +214,17 @@ if (this.options.zIndex !== null) modal.css('z-index', this.options.zIndex + 20) + + if (this.options.allowDismiss) { + modal.on('click', function(e) { + const target = e.target; + if (target.classList.contains('control-popup')) { + modal.hide() + $('.popup-backdrop').remove() + $(document.body).removeClass('modal-open') + } + }); + } return modal.append(modalDialog.append(modalContent)) } From 55701c2e13825e5fd32908d6caa4db4f5cfe12df Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:34:45 +0100 Subject: [PATCH 10/12] [add] allowDismiss --- modules/system/assets/ui/storm-min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/assets/ui/storm-min.js b/modules/system/assets/ui/storm-min.js index 0f591ede9d..2ca09904bc 100644 --- a/modules/system/assets/ui/storm-min.js +++ b/modules/system/assets/ui/storm-min.js @@ -2153,7 +2153,7 @@ this.initEvents() this.init()} Popup.prototype=Object.create(BaseProto) Popup.prototype.constructor=Popup -Popup.DEFAULTS={ajax:null,handler:null,keyboard:true,extraData:{},content:null,size:null,adaptiveHeight:false,zIndex:null,cssClass:null} +Popup.DEFAULTS={ajax:null,handler:null,keyboard:true,extraData:{},content:null,size:null,adaptiveHeight:false,zIndex:null,cssClass:null,allowDismiss:false} Popup.prototype.init=function(){var self=this if(self.isOpen)return this.setBackdrop(true) From 3a1511af05f263d7ea816467eaf2a79ce22689bc Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:02:45 +0200 Subject: [PATCH 11/12] Update popup.js Only trigger on mousedown, because when selecting text to copy you sometimes leave the modal and that would close it. --- modules/system/assets/ui/js/popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/assets/ui/js/popup.js b/modules/system/assets/ui/js/popup.js index bea65444b0..7f0bce777f 100644 --- a/modules/system/assets/ui/js/popup.js +++ b/modules/system/assets/ui/js/popup.js @@ -216,7 +216,7 @@ modal.css('z-index', this.options.zIndex + 20) if (this.options.allowDismiss) { - modal.on('click', function(e) { + modal.on('mousedown', function(e) { const target = e.target; if (target.classList.contains('control-popup')) { modal.hide() From f4bf2ec834822df185998a932447c89f86d5a796 Mon Sep 17 00:00:00 2001 From: AIC BV <89913092+AIC-BV@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:05:14 +0200 Subject: [PATCH 12/12] Update storm-min.js --- modules/system/assets/ui/storm-min.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/system/assets/ui/storm-min.js b/modules/system/assets/ui/storm-min.js index 2ca09904bc..a7f4373e60 100644 --- a/modules/system/assets/ui/storm-min.js +++ b/modules/system/assets/ui/storm-min.js @@ -1954,7 +1954,8 @@ var selectOptions={templateResult:formatSelectOption,templateSelection:formatSel $('select.custom-select').each(function(){var $element=$(this),extraOptions={dropdownCssClass:'',containerCssClass:''} if($element.data('select2')!=null){return true;}$element.attr('data-disposable','data-disposable') $element.one('dispose-control',function(){if($element.data('select2')){$element.select2('destroy')}}) -if($element.hasClass('select-no-search')){extraOptions.minimumResultsForSearch=Infinity}if($element.hasClass('select-no-dropdown')){extraOptions.dropdownCssClass+=' select-no-dropdown' +if($element.hasClass('select-no-search')){extraOptions.minimumResultsForSearch=Infinity}if($element.hasClass('select-modifiable')){extraOptions.tags=true;extraOptions.createTag=function(params){var term=$.trim(params.term);if(term===''){return null;}return{id:term,text:term,newTag:true};} +extraOptions.templateResult=function(state){if(!state.id){return state.text;}var icon=state.newTag?' ':'';return $(''+icon+state.text+'');}}if($element.hasClass('select-no-dropdown')){extraOptions.dropdownCssClass+=' select-no-dropdown' extraOptions.containerCssClass+=' select-no-dropdown'}if($element.hasClass('select-hide-selected')){extraOptions.dropdownCssClass+=' select-hide-selected'}var source=$element.data('handler');if(source){extraOptions.ajax={transport:function(params,success,failure){var $request=$element.request(source,{data:params.data}) $request.done(success) $request.fail(failure) @@ -2199,7 +2200,9 @@ if(this.options.size)modalDialog.addClass('size-'+this.options.size) if(this.options.adaptiveHeight)modalDialog.addClass('adaptive-height') if(this.options.cssClass)modalDialog.addClass(this.options.cssClass) if(this.options.zIndex!==null)modal.css('z-index',this.options.zIndex+20) -return modal.append(modalDialog.append(modalContent))} +if(this.options.allowDismiss){modal.on('mousedown',function(e){const target=e.target;if(target.classList.contains('control-popup')){modal.hide() +$('.popup-backdrop').remove() +$(document.body).removeClass('modal-open')}});}return modal.append(modalDialog.append(modalContent))} Popup.prototype.setContent=function(contents){this.$content.html(contents) this.setLoading(false) this.show() @@ -2815,7 +2818,7 @@ return this}}(window.jQuery);+function($){"use strict";var Tab=function(element, this.$tabsContainer=$('.nav-tabs:first',$el) this.$pagesContainer=$('.tab-content:first',$el) this.tabId='tabs'+$el.parents().length+Math.round(Math.random()*1000);if(this.options.closable!==undefined&&this.options.closable!==false)$el.attr('data-closable','') -var self=this;setTimeout(function(){self.init()},300)} +this.init()} Tab.prototype.init=function(){var self=this;this.options.slidable=this.options.slidable!==undefined&&this.options.slidable!==false $('> li',this.$tabsContainer).each(function(index){self.initTab(this)}) this.$el.on('close.oc.tab',function(ev,data){ev.preventDefault()