From 67d660ef1f8cd39e47f032513d45a5d04b169744 Mon Sep 17 00:00:00 2001 From: dilanua Date: Wed, 19 Oct 2016 19:08:34 +0530 Subject: [PATCH] Fixing JIRA: EMM-1765 --- .../public/js/policy-create.js | 20 ++++++++++++++++ .../mdm.unit.policy.edit/public/js/edit.js | 24 +++++++++++-------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js index c839877f00..1c1eefcfd6 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js @@ -2790,6 +2790,26 @@ $(document).ready(function () { } }); + // + $(advanceOperations).on('hidden.bs.collapse', function (event) { + var collapsedFeatureBody = event.target.id; + var featureConfiguringSwitch = "#" + collapsedFeatureBody. + substr(0, collapsedFeatureBody.lastIndexOf("-")) + "-heading input[type=checkbox]"; + if ($(featureConfiguringSwitch).prop("checked") == true) { + $(featureConfiguringSwitch).prop("checked", false); + } + }); + + $(advanceOperations).on('shown.bs.collapse', function (event) { + var expandedFeatureBody = event.target.id; + var featureConfiguringSwitch = "#" + expandedFeatureBody. + substr(0, expandedFeatureBody.lastIndexOf("-")) + "-heading input[type=checkbox]"; + if ($(featureConfiguringSwitch).prop("checked") == false) { + $(featureConfiguringSwitch).prop("checked", true); + } + }); + // + // adding support for cloning multiple profiles per feature with cloneable class definitions $(advanceOperations).on("click", ".multi-view.add.enabled", function () { // get a copy of .cloneable and create new .cloned div element diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js index 23df93491f..7c899b3cb4 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js @@ -2553,21 +2553,25 @@ $(document).ready(function () { } }); - - $(advanceOperations).on('hidden.bs.collapse', function () { - if($(this).find('input').prop('checked')){ - $(this).find('input').prop('checked',false); + // + $(advanceOperations).on('hidden.bs.collapse', function (event) { + var collapsedFeatureBody = event.target.id; + var featureConfiguringSwitch = "#" + collapsedFeatureBody. + substr(0, collapsedFeatureBody.lastIndexOf("-")) + "-heading input[type=checkbox]"; + if ($(featureConfiguringSwitch).prop("checked") == true) { + $(featureConfiguringSwitch).prop("checked", false); } }); - - $(advanceOperations).on('shown.bs.collapse', function () { - if($(this).find('input').prop('checked') == false){ - $(this).find('input').prop('checked',true); + $(advanceOperations).on('shown.bs.collapse', function (event) { + var expandedFeatureBody = event.target.id; + var featureConfiguringSwitch = "#" + expandedFeatureBody. + substr(0, expandedFeatureBody.lastIndexOf("-")) + "-heading input[type=checkbox]"; + if ($(featureConfiguringSwitch).prop("checked") == false) { + $(featureConfiguringSwitch).prop("checked", true); } }); - - + // // adding support for cloning multiple profiles per feature with cloneable class definitions $(advanceOperations).on("click", ".multi-view.add.enabled", function () {