From 39a4b012ae15356b133d669b074e2d4a5b1c82b9 Mon Sep 17 00:00:00 2001 From: Olle Haerstedt Date: Thu, 22 Sep 2016 12:44:06 +0200 Subject: [PATCH] Dev: Abort immediately if no massive action checkbox is checked --- .../assets/listActions.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/application/extensions/admin/grid/MassiveActionsWidget/assets/listActions.js b/application/extensions/admin/grid/MassiveActionsWidget/assets/listActions.js index e5fda17801f..a3433d8cfcb 100644 --- a/application/extensions/admin/grid/MassiveActionsWidget/assets/listActions.js +++ b/application/extensions/admin/grid/MassiveActionsWidget/assets/listActions.js @@ -25,6 +25,13 @@ $(document).on('click', '.listActions a', function () var $oCheckedItems = JSON.stringify($oCheckedItems); var actionType = $that.data('actionType'); + if( $oCheckedItems == '[]' ) { + //If no item selected, the error modal "please select first an item" is shown + // TODO: add a variable in the widget to replace "item" by the item type (e.g: survey, question, token, etc.) + $('#error-first-select').modal(); + return; + } + // TODO : Switch action (post, session, ajax...) // For actions without modal, doing a redirection @@ -75,6 +82,7 @@ $(document).on('click', '.listActions a', function () console.log('js', js); var func = eval(js); func(); + return; } // TODO: switch case "Modal" @@ -174,16 +182,7 @@ $(document).on('click', '.listActions a', function () }); // open the modal - if( $oCheckedItems !== '[]' ) - { - $modal.modal(); - } - else - { - //If no item selected, the error modal "please select first an item" is shown - // TODO: add a variable in the widget to replace "item" by the item type (e.g: survey, question, token, etc.) - $('#error-first-select').modal(); - } + $modal.modal(); }); /**