Skip to content

Commit 3d7eb26

Browse files
MAGETWO-69954: Add target attribute to Magento_Ui grid #9964
2 parents 100af87 + 88234db commit 3d7eb26

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,20 @@ define([
176176
}
177177
},
178178

179+
/**
180+
* Returns target of action if it's been set.
181+
*
182+
* @param {Object} action - Action object.
183+
* @returns {String}
184+
*/
185+
getTarget: function (action) {
186+
if (action.target) {
187+
return action.target;
188+
}
189+
190+
return '_self';
191+
},
192+
179193
/**
180194
* Checks if specified action requires a handler function.
181195
*

app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
repeat="foreach: $col.getVisibleActions($row()._rowIndex), item: '$action'"
1111
click="$col.getActionHandler($action())"
1212
text="$action().label"
13-
attr="href: $action().href"/>
13+
attr="target: $col.getTarget($action()), href: $action().href"/>
1414

1515
<div class="action-select-wrap" if="$col.isMultiple($row()._rowIndex)" collapsible>
1616
<button class="action-select" translate="'Select'" toggleCollapsible/>
1717
<ul class="action-menu" css="_active: $collapsible.opened">
1818
<li repeat="foreach: $col.getVisibleActions($row()._rowIndex), item: '$action'">
19-
<a class="action-menu-item" click="$col.getActionHandler($action())" text="$action().label" attr="href: $action().href, 'data-action': 'item-' + $action().index"/>
19+
<a class="action-menu-item" click="$col.getActionHandler($action())" text="$action().label" attr="target: $col.getTarget($action()), href: $action().href, 'data-action': 'item-' + $action().index"/>
2020
</li>
2121
</ul>
2222
</div>

0 commit comments

Comments
 (0)