Skip to content

Commit

Permalink
MAGETWO-69954: Add target attribute to Magento_Ui grid #9964
Browse files Browse the repository at this point in the history
  • Loading branch information
ishakhsuvarov authored Jun 19, 2017
2 parents 100af87 + 88234db commit 3d7eb26
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,20 @@ define([
}
},

/**
* Returns target of action if it's been set.
*
* @param {Object} action - Action object.
* @returns {String}
*/
getTarget: function (action) {
if (action.target) {
return action.target;
}

return '_self';
},

/**
* Checks if specified action requires a handler function.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
repeat="foreach: $col.getVisibleActions($row()._rowIndex), item: '$action'"
click="$col.getActionHandler($action())"
text="$action().label"
attr="href: $action().href"/>
attr="target: $col.getTarget($action()), href: $action().href"/>

<div class="action-select-wrap" if="$col.isMultiple($row()._rowIndex)" collapsible>
<button class="action-select" translate="'Select'" toggleCollapsible/>
<ul class="action-menu" css="_active: $collapsible.opened">
<li repeat="foreach: $col.getVisibleActions($row()._rowIndex), item: '$action'">
<a class="action-menu-item" click="$col.getActionHandler($action())" text="$action().label" attr="href: $action().href, 'data-action': 'item-' + $action().index"/>
<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"/>
</li>
</ul>
</div>

0 comments on commit 3d7eb26

Please sign in to comment.