From 072fb342ba34a4d873d70d17a76b39527634e2b8 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 9 Dec 2016 18:24:11 +0530 Subject: [PATCH] changed the code for settings. Need to stop the multiple call on settingsEvent listener then will fix the bug --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 18 ++++++++++-------- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 64 +++++++++++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 55 insertions(+), 27 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 0d5aa22..6fe9003 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -6320,17 +6320,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //Reload DA controller Body View after setting Change $scope.$on('reloadDABodyViewEvent', function (event, data) { //console.log('reloadDABodyViewEvent'); - $scope.layerNumber = parseInt($('#txtlayerNumber').val()); - //alert('mouseUp'); + if ($rootScope.isSettingEventAlredayDispachted == true) { + $rootScope.isSettingEventAlredayDispachted = false; + $scope.layerNumber = parseInt($('#txtlayerNumber').val()); + //alert('mouseUp'); - if ($scope.layerNumber == 0) { - $scope.loadSelectedBodyView(data.reloadDABodyViewId); - } - // $scope.loadSelectedBodyView(data.reloadDABodyViewId); - - $scope.loadSelectedBodyViewNavigator(data.reloadDABodyViewId); + if ($scope.layerNumber == 0) { + $scope.loadSelectedBodyView(data.reloadDABodyViewId); + } + // $scope.loadSelectedBodyView(data.reloadDABodyViewId); + $scope.loadSelectedBodyViewNavigator(data.reloadDABodyViewId); + } // $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); //$rootScope.isSettingEventAlredayDispachted = false; diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 1022e65..0690ce8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -2047,38 +2047,64 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }; $rootScope.UpdateSetting = function (setting) { - + var isReloadingViewRequired = false; //1. if (typeof (setting.ethnicity) !== "undefined" && setting.ethnicity !== null) { $rootScope.ChangeEthnicity(setting, setting.ethnicity); - $rootScope.globalSetting.ethnicity = setting.ethnicity; - localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); - $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity); - } + } if (typeof (setting.modesty) !== "undefined" && setting.modesty !== null) { $rootScope.ChangeModesty(setting, setting.modesty); - $rootScope.globalSetting.modesty = setting.modesty; - localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); - $rootScope.setModestySettings($rootScope.globalSetting.modesty); } //2. - //localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); + if((setting.ethnicity!=null && setting.ethnicity!= $rootScope.globalSetting.ethnicity) && (setting.modesty!=null && setting.modesty != $rootScope.globalSetting.modesty) ){ + $rootScope.globalSetting.ethnicity = setting.ethnicity; + localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); + + $rootScope.globalSetting.modesty = setting.modesty; + localStorage.setItem("globalModesty", setting.modesty); + + isReloadingViewRequired = true; + + } + + else if (setting.ethnicity != $rootScope.globalSetting.ethnicity) { - //3. - //localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); + $rootScope.globalSetting.ethnicity = setting.ethnicity; + localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); - //4. - //$rootScope.reloadChildController(); + $rootScope.globalSetting.modesty = localStorage.getItem("globalModesty"); - var len = $rootScope.openModules.length; - if (len > 0) { - $rootScope.reloadChildController(); + isReloadingViewRequired = true; } - else { - $('#modal-settings').modal('hide'); + else if (setting.modesty != $rootScope.globalSetting.modesty) { + $rootScope.globalSetting.modesty = setting.modesty; + localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); + + if ($('.modestyImg') != null) { + if (($rootScope.globalSetting.modesty == 'Y')) { + $('.modestyImg').css('visibility', 'visible'); + } + + else { + $('.modestyImg').css('visibility', 'hidden'); + } + } } + //4. + //$rootScope.reloadChildController(); + + var len = $rootScope.openModules.length; + if (len > 0) { + if (isReloadingViewRequired == true) { + $rootScope.reloadChildController(); + } + } + else { + $('#modal-settings').modal('hide'); + } + }; $rootScope.reloadChildController = function () { @@ -2094,7 +2120,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", if ($rootScope.openViews.length > 0) { var openViewLen = $rootScope.openViews.length; var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId; - //$rootScope.isSettingEventAlredayDispachted = true; + $rootScope.isSettingEventAlredayDispachted = true; $rootScope.$broadcast('reloadDABodyViewEvent', { reloadDABodyViewId: currentOpenViewId }, true); } else { -- libgit2 0.21.4