Commit cb53b708 by Samuel Padgett

Add `.tile-click-prevent` class

Add a `.tile-click-prevent` class to optionally block activating the
tile click target on children of the tile click element.
parent 6abfb2b4
......@@ -885,9 +885,9 @@ angular.module('openshiftCommonUI')
restrict: 'AC',
link: function($scope, element) {
$(element).click(function (evt) {
// Don't trigger tile target if the user clicked directly on a link or button inside the tile.
// Don't trigger tile target if the user clicked directly on a link or button inside the tile or any child of a .tile-click-prevent element.
var t = $(evt.target);
if (t && (t.closest("a", element).length || t.closest("button", element).length)) {
if (t && (t.closest("a", element).length || t.closest("button", element).length) || t.closest(".tile-click-prevent", element).length) {
return;
}
$('a.tile-target', element).trigger("click");
......
......@@ -1056,9 +1056,9 @@ angular.module('openshiftCommonUI')
restrict: 'AC',
link: function($scope, element) {
$(element).click(function (evt) {
// Don't trigger tile target if the user clicked directly on a link or button inside the tile.
// Don't trigger tile target if the user clicked directly on a link or button inside the tile or any child of a .tile-click-prevent element.
var t = $(evt.target);
if (t && (t.closest("a", element).length || t.closest("button", element).length)) {
if (t && (t.closest("a", element).length || t.closest("button", element).length) || t.closest(".tile-click-prevent", element).length) {
return;
}
$('a.tile-target', element).trigger("click");
......
......@@ -339,7 +339,7 @@ restrict:"AC",
link:function($scope, element) {
$(element).click(function(evt) {
var t = $(evt.target);
t && (t.closest("a", element).length || t.closest("button", element).length) || $("a.tile-target", element).trigger("click");
t && (t.closest("a", element).length || t.closest("button", element).length) || t.closest(".tile-click-prevent", element).length || $("a.tile-target", element).trigger("click");
});
}
};
......
......@@ -6,9 +6,9 @@ angular.module('openshiftCommonUI')
restrict: 'AC',
link: function($scope, element) {
$(element).click(function (evt) {
// Don't trigger tile target if the user clicked directly on a link or button inside the tile.
// Don't trigger tile target if the user clicked directly on a link or button inside the tile or any child of a .tile-click-prevent element.
var t = $(evt.target);
if (t && (t.closest("a", element).length || t.closest("button", element).length)) {
if (t && (t.closest("a", element).length || t.closest("button", element).length) || t.closest(".tile-click-prevent", element).length) {
return;
}
$('a.tile-target', element).trigger("click");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment