From d5c7882d770e31901a0959e65c8511b677dfef64 Mon Sep 17 00:00:00 2001 From: James Reed Date: Thu, 15 Jun 2017 11:36:07 +0100 Subject: [PATCH 1/3] Added target attribute to Magento_Ui grid - added getTarget method to actions.js and display to actions.html --- .../Ui/view/base/web/js/grid/columns/actions.js | 14 ++++++++++++++ .../base/web/templates/grid/cells/actions.html | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js index 6174700c27a8b..513a68ecafb99 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js @@ -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. * diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html b/app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html index ccaec7b3a2192..3465e4774e9c4 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/cells/actions.html @@ -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"/>
From c8c76739d50fa0f9f1be519cb1493a1dd50b5810 Mon Sep 17 00:00:00 2001 From: James Reed Date: Fri, 16 Jun 2017 13:54:30 +0100 Subject: [PATCH 2/3] missing comma added. --- app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js index 513a68ecafb99..5fb6f6720cf3b 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js @@ -188,7 +188,7 @@ define([ } return "_self"; - } + }, /** * Checks if specified action requires a handler function. From 4d26bd3596a19ae8e29143fe34d543be9f618eeb Mon Sep 17 00:00:00 2001 From: James Reed Date: Fri, 16 Jun 2017 15:44:25 +0100 Subject: [PATCH 3/3] change of quote type on return --- app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js index 5fb6f6720cf3b..a4c56958911a8 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js @@ -187,7 +187,7 @@ define([ return action.target; } - return "_self"; + return '_self'; }, /**