Commit 072fb342ba34a4d873d70d17a76b39527634e2b8
1 parent
e554bd8b
changed the code for settings.
Need to stop the multiple call on settingsEvent listener then will fix the bug
Showing
2 changed files
with
55 additions
and
27 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -6320,17 +6320,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
6320 | 6320 | //Reload DA controller Body View after setting Change |
6321 | 6321 | $scope.$on('reloadDABodyViewEvent', function (event, data) { |
6322 | 6322 | //console.log('reloadDABodyViewEvent'); |
6323 | - $scope.layerNumber = parseInt($('#txtlayerNumber').val()); | |
6324 | - //alert('mouseUp'); | |
6323 | + if ($rootScope.isSettingEventAlredayDispachted == true) { | |
6324 | + $rootScope.isSettingEventAlredayDispachted = false; | |
6325 | + $scope.layerNumber = parseInt($('#txtlayerNumber').val()); | |
6326 | + //alert('mouseUp'); | |
6325 | 6327 | |
6326 | 6328 | |
6327 | - if ($scope.layerNumber == 0) { | |
6328 | - $scope.loadSelectedBodyView(data.reloadDABodyViewId); | |
6329 | - } | |
6330 | - // $scope.loadSelectedBodyView(data.reloadDABodyViewId); | |
6331 | - | |
6332 | - $scope.loadSelectedBodyViewNavigator(data.reloadDABodyViewId); | |
6329 | + if ($scope.layerNumber == 0) { | |
6330 | + $scope.loadSelectedBodyView(data.reloadDABodyViewId); | |
6331 | + } | |
6332 | + // $scope.loadSelectedBodyView(data.reloadDABodyViewId); | |
6333 | 6333 | |
6334 | + $scope.loadSelectedBodyViewNavigator(data.reloadDABodyViewId); | |
6335 | + } | |
6334 | 6336 | // $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); |
6335 | 6337 | |
6336 | 6338 | //$rootScope.isSettingEventAlredayDispachted = false; | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -2047,38 +2047,64 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
2047 | 2047 | }; |
2048 | 2048 | |
2049 | 2049 | $rootScope.UpdateSetting = function (setting) { |
2050 | - | |
2050 | + var isReloadingViewRequired = false; | |
2051 | 2051 | //1. |
2052 | 2052 | if (typeof (setting.ethnicity) !== "undefined" && setting.ethnicity !== null) { |
2053 | 2053 | $rootScope.ChangeEthnicity(setting, setting.ethnicity); |
2054 | - $rootScope.globalSetting.ethnicity = setting.ethnicity; | |
2055 | - localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); | |
2056 | - $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity); | |
2057 | - } | |
2054 | + } | |
2058 | 2055 | if (typeof (setting.modesty) !== "undefined" && setting.modesty !== null) { |
2059 | 2056 | $rootScope.ChangeModesty(setting, setting.modesty); |
2060 | - $rootScope.globalSetting.modesty = setting.modesty; | |
2061 | - localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); | |
2062 | - $rootScope.setModestySettings($rootScope.globalSetting.modesty); | |
2063 | 2057 | } |
2064 | 2058 | |
2065 | 2059 | //2. |
2066 | - //localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); | |
2060 | + if((setting.ethnicity!=null && setting.ethnicity!= $rootScope.globalSetting.ethnicity) && (setting.modesty!=null && setting.modesty != $rootScope.globalSetting.modesty) ){ | |
2061 | + $rootScope.globalSetting.ethnicity = setting.ethnicity; | |
2062 | + localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); | |
2063 | + | |
2064 | + $rootScope.globalSetting.modesty = setting.modesty; | |
2065 | + localStorage.setItem("globalModesty", setting.modesty); | |
2066 | + | |
2067 | + isReloadingViewRequired = true; | |
2068 | + | |
2069 | + } | |
2070 | + | |
2071 | + else if (setting.ethnicity != $rootScope.globalSetting.ethnicity) { | |
2067 | 2072 | |
2068 | - //3. | |
2069 | - //localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); | |
2073 | + $rootScope.globalSetting.ethnicity = setting.ethnicity; | |
2074 | + localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); | |
2070 | 2075 | |
2071 | - //4. | |
2072 | - //$rootScope.reloadChildController(); | |
2076 | + $rootScope.globalSetting.modesty = localStorage.getItem("globalModesty"); | |
2073 | 2077 | |
2074 | - var len = $rootScope.openModules.length; | |
2075 | - if (len > 0) { | |
2076 | - $rootScope.reloadChildController(); | |
2078 | + isReloadingViewRequired = true; | |
2077 | 2079 | } |
2078 | - else { | |
2079 | - $('#modal-settings').modal('hide'); | |
2080 | + else if (setting.modesty != $rootScope.globalSetting.modesty) { | |
2081 | + $rootScope.globalSetting.modesty = setting.modesty; | |
2082 | + localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); | |
2083 | + | |
2084 | + if ($('.modestyImg') != null) { | |
2085 | + if (($rootScope.globalSetting.modesty == 'Y')) { | |
2086 | + $('.modestyImg').css('visibility', 'visible'); | |
2087 | + } | |
2088 | + | |
2089 | + else { | |
2090 | + $('.modestyImg').css('visibility', 'hidden'); | |
2091 | + } | |
2092 | + } | |
2080 | 2093 | } |
2081 | 2094 | |
2095 | + //4. | |
2096 | + //$rootScope.reloadChildController(); | |
2097 | + | |
2098 | + var len = $rootScope.openModules.length; | |
2099 | + if (len > 0) { | |
2100 | + if (isReloadingViewRequired == true) { | |
2101 | + $rootScope.reloadChildController(); | |
2102 | + } | |
2103 | + } | |
2104 | + else { | |
2105 | + $('#modal-settings').modal('hide'); | |
2106 | + } | |
2107 | + | |
2082 | 2108 | }; |
2083 | 2109 | |
2084 | 2110 | $rootScope.reloadChildController = function () { |
... | ... | @@ -2094,7 +2120,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
2094 | 2120 | if ($rootScope.openViews.length > 0) { |
2095 | 2121 | var openViewLen = $rootScope.openViews.length; |
2096 | 2122 | var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId; |
2097 | - //$rootScope.isSettingEventAlredayDispachted = true; | |
2123 | + $rootScope.isSettingEventAlredayDispachted = true; | |
2098 | 2124 | $rootScope.$broadcast('reloadDABodyViewEvent', { reloadDABodyViewId: currentOpenViewId }, true); |
2099 | 2125 | } |
2100 | 2126 | else { | ... | ... |