Skip to content

Commit 19a27fd

Browse files
committed
support action-ref-by-name on link with _black target like action-ref-by-href action
1 parent aa006ff commit 19a27fd

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

dist/bootstrap-actionable.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/bootstrap-actionable.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,15 @@
4848
});
4949
} else if (actionType === "action-ref") {
5050
var actionRefName = $(this).attr("action-ref-by-name") ? $(this).attr("action-ref-by-name") : "";
51-
if ($(actionScope + " [action-name='" + actionRefName + "']").length > 0)
52-
$(actionScope + " [action-name='" + actionRefName + "']:first").trigger("click");
51+
if ($(actionScope + " [action-name='" + actionRefName + "']").length > 0) {
52+
var linkTag = $(actionScope + " [href='" + actionRefName + "']:first");
53+
// check if current link tag has attribute target
54+
if (linkTag.attr('target')) {
55+
window.open(linkTag.attr("href"), linkTag.attr('target'));
56+
} else {
57+
$(linkTag).trigger("click");
58+
}
59+
}
5360
} else if (actionType === "action-ref-href") {
5461
var actionRefName = $(this).attr("action-ref-by-href") ? $(this).attr("action-ref-by-href") : "";
5562
if ($(actionScope + " [href='" + actionRefName + "']").length > 0) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bootstrap-actionable",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Actionable plugin is a small Javascript code that help implement click actions for a and button tags by declarative way and provide functionalities to load AJAX content in Bootstrap Modal Wrapper instance.",
55
"keywords": [
66
"bootstrap",

0 commit comments

Comments
 (0)