From 58ed3e12d21ec9056c033419e8dff2e22cb1144c Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Fri, 26 Aug 2016 19:11:38 +1000 Subject: [PATCH] Improvements to row link script If data-control="popup" or data-request="onSomething" is attached to the anchor, utilize that functionality when clicking the row --- modules/system/assets/ui/js/list.rowlink.js | 26 +++++++++++++++------ modules/system/assets/ui/storm-min.js | 18 +++++++------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/modules/system/assets/ui/js/list.rowlink.js b/modules/system/assets/ui/js/list.rowlink.js index 75bf835f4..9be759538 100644 --- a/modules/system/assets/ui/js/list.rowlink.js +++ b/modules/system/assets/ui/js/list.rowlink.js @@ -36,18 +36,30 @@ if (!link.length) return var href = link.attr('href'), - onclick = (typeof link.get(0).onclick == "function") ? link.get(0).onclick : null + onclick = (typeof link.get(0).onclick == "function") ? link.get(0).onclick : null, + popup = link.is('[data-control=popup]'), + request = link.is('[data-request]') $(this).find('td').not('.' + options.excludeClass).click(function(e) { - if ($(document.body).hasClass('drag')) + if ($(document.body).hasClass('drag')) { return + } - if (onclick) + if (onclick) { onclick.apply(link.get(0)) - else if (e.ctrlKey) - window.open(href); - else - window.location = href; + } + else if (request) { + link.request() + } + else if (popup) { + link.popup() + } + else if (e.ctrlKey) { + window.open(href) + } + else { + window.location = href + } }) $(this).addClass(options.linkedClass) diff --git a/modules/system/assets/ui/storm-min.js b/modules/system/assets/ui/storm-min.js index 8bf12f1d1..85c01bc73 100644 --- a/modules/system/assets/ui/storm-min.js +++ b/modules/system/assets/ui/storm-min.js @@ -3453,8 +3453,7 @@ this.firstDiv=this.$content.find('>div:first') if(this.firstDiv.length>0) this.firstDiv.data('oc.popup',this) var $defaultFocus=$('[default-focus]',this.$content) -if($defaultFocus.is(":visible")) -{window.setTimeout(function(){$defaultFocus.focus() +if($defaultFocus.is(":visible")){window.setTimeout(function(){$defaultFocus.focus() $defaultFocus=null},300)}} Popup.prototype.setBackdrop=function(val){if(val&&!this.$backdrop){this.$backdrop=$('