From a67ef75bfbb7d634b9bb6acd474f9714912023ed Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Sep 2017 10:34:55 +0530 Subject: [PATCH] Commit Changes --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 62 ++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index c2e34b0..a6f0fff 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -507,13 +507,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.secondlaxtext = $("#secondLax option:selected").text(); }); - + $("#laxiconLangRemove").click(function () { if ($rootScope.isActiveLexiconLanguageClicked == true) { $rootScope.isActiveLexiconLanguageClicked = false; $("#secondLax :selected").remove(); $('#lexiconLangDropdown').append(''); - // $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1); + // $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1); $rootScope.lexiconLanguageArray = []; $("#secondLax > option").each(function () { $rootScope.lexiconLanguageArray.push({ id: $(this).attr("val"), language: this.value }); @@ -1013,6 +1013,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $('#modal-settings').css("display", "block"); $("#modelsettingsbackground").css("display", "block"); } + $rootScope.lexiconLanguageArrayLength = $rootScope.lexiconLanguageArray.length; $rootScope.lexiconPrimaryLanguage = $("#primarylaxican").val(); $rootScope.primaryLangID = $('#primarylaxican').attr("name"); @@ -3436,26 +3437,34 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.setModestySettings(formsetting.modesty); } - + $rootScope.isApplyBtnClicked = false; $rootScope.CloseSetting = function () { - + $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity); $rootScope.setModestySettings($rootScope.globalSetting.modesty); - $rootScope.deSelectLanguageOptions(); + if ($rootScope.isApplyBtnClicked == false) { + + $rootScope.deSelectLanguageOptions(); + } + else { + + $rootScope.isApplyBtnClicked = false; + } $('#modal-settings').css("display", "none"); $("#modelsettingsbackground").css("display", "none"); } $rootScope.UpdateAndCloseSetting = function (setting) { - // debugger; + $rootScope.UpdateSetting(setting); $rootScope.loadSearchData(); - + $rootScope.isApplyBtnClicked = false; //$timeout(function () { $('#modal-settings').css("display", "none"); $("#modelsettingsbackground").css("display", "none"); // $("#setting-spinner").css("display", "none"); $("#setting-spinner").css("display", "block"); + $rootScope.lexiconLanguageArrayLength = $rootScope.lexiconLanguageArray.length; // }, 6000); @@ -3463,21 +3472,31 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.CloseSettingPopup = function () { - $rootScope.deSelectLanguageOptions(); + if ($rootScope.isApplyBtnClicked == false) { + $rootScope.deSelectLanguageOptions(); + } + else { + $rootScope.isApplyBtnClicked = false; + } $('#modal-settings').css("display", "none"); $("#modelsettingsbackground").css("display", "none"); } $rootScope.deSelectLanguageOptions = function () { - if ($rootScope.lexiconLanguageArrayLength < $rootScope.lexiconLanguageArray.length) { - + var languageDifference = ($rootScope.lexiconLanguageArrayLength) - ($rootScope.lexiconLanguageArray.length); - if (languageDifference > 0) { - // alert("positive value") + for (var i = 0; i <= $rootScope.lexiconRemovedLanguage.length - 1; i++) { + $("#lexiconLangDropdown option").each(function () { + if ($rootScope.lexiconRemovedLanguage[i].language == $(this).val()) { + $(this).remove(); + $('#secondLax').append(''); + $rootScope.lexiconLanguageArray.push({ "id": $rootScope.lexiconRemovedLanguage[i].id, "language": $rootScope.lexiconRemovedLanguage[i].language }); + } + }); + } } - else { - + else if (languageDifference < 0) { languageDifference = Math.abs(languageDifference); for (var i = 1; i <= languageDifference; i++) { var lexiconArrayLength = $rootScope.lexiconLanguageArray.length; @@ -3492,8 +3511,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.lexiconLanguageArray.pop(); } } - } - + if ($rootScope.lexiconPrimaryLanguage == $("#primarylaxican").val()) { // alert("same name"); @@ -3512,8 +3530,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } } - + $rootScope.UpdateSetting = function (setting) { + $rootScope.isApplyBtnClicked = true; var isReloadingViewRequired = false; //1. if (typeof (setting.ethnicity) !== "undefined" && setting.ethnicity !== null) { @@ -3570,10 +3589,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } else { - $('#modal-settings').css("display", "none"); - $("#modelsettingsbackground").css("display", "none"); + // $('#modal-settings').css("display", "none"); + // $("#modelsettingsbackground").css("display", "none"); } - + $rootScope.lexiconRemovedLanguage = []; + $("#secondLax option").each(function () { + $rootScope.lexiconRemovedLanguage.push({ "id": $(this).attr("val"), "language": $(this).val() }); + }); }; -- libgit2 0.21.4