Commit a67ef75bfbb7d634b9bb6acd474f9714912023ed
1 parent
47c1530c
Commit Changes
Showing
1 changed file
with
42 additions
and
20 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -507,13 +507,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
507 | 507 | $rootScope.secondlaxtext = $("#secondLax option:selected").text(); |
508 | 508 | |
509 | 509 | }); |
510 | - | |
510 | + | |
511 | 511 | $("#laxiconLangRemove").click(function () { |
512 | 512 | if ($rootScope.isActiveLexiconLanguageClicked == true) { |
513 | 513 | $rootScope.isActiveLexiconLanguageClicked = false; |
514 | 514 | $("#secondLax :selected").remove(); |
515 | 515 | $('#lexiconLangDropdown').append('<option val="' + $rootScope.secondlaxdid + '">' + $rootScope.secondlaxtext + '</option>'); |
516 | - // $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1); | |
516 | + // $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1); | |
517 | 517 | $rootScope.lexiconLanguageArray = []; |
518 | 518 | $("#secondLax > option").each(function () { |
519 | 519 | $rootScope.lexiconLanguageArray.push({ id: $(this).attr("val"), language: this.value }); |
... | ... | @@ -1013,6 +1013,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
1013 | 1013 | $('#modal-settings').css("display", "block"); |
1014 | 1014 | $("#modelsettingsbackground").css("display", "block"); |
1015 | 1015 | } |
1016 | + | |
1016 | 1017 | $rootScope.lexiconLanguageArrayLength = $rootScope.lexiconLanguageArray.length; |
1017 | 1018 | $rootScope.lexiconPrimaryLanguage = $("#primarylaxican").val(); |
1018 | 1019 | $rootScope.primaryLangID = $('#primarylaxican').attr("name"); |
... | ... | @@ -3436,26 +3437,34 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
3436 | 3437 | $rootScope.setModestySettings(formsetting.modesty); |
3437 | 3438 | |
3438 | 3439 | } |
3439 | - | |
3440 | + $rootScope.isApplyBtnClicked = false; | |
3440 | 3441 | $rootScope.CloseSetting = function () { |
3441 | - | |
3442 | + | |
3442 | 3443 | $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity); |
3443 | 3444 | $rootScope.setModestySettings($rootScope.globalSetting.modesty); |
3444 | - $rootScope.deSelectLanguageOptions(); | |
3445 | + if ($rootScope.isApplyBtnClicked == false) { | |
3446 | + | |
3447 | + $rootScope.deSelectLanguageOptions(); | |
3448 | + } | |
3449 | + else { | |
3450 | + | |
3451 | + $rootScope.isApplyBtnClicked = false; | |
3452 | + } | |
3445 | 3453 | $('#modal-settings').css("display", "none"); |
3446 | 3454 | $("#modelsettingsbackground").css("display", "none"); |
3447 | 3455 | } |
3448 | 3456 | |
3449 | 3457 | $rootScope.UpdateAndCloseSetting = function (setting) { |
3450 | - // debugger; | |
3458 | + | |
3451 | 3459 | $rootScope.UpdateSetting(setting); |
3452 | 3460 | $rootScope.loadSearchData(); |
3453 | - | |
3461 | + $rootScope.isApplyBtnClicked = false; | |
3454 | 3462 | //$timeout(function () { |
3455 | 3463 | $('#modal-settings').css("display", "none"); |
3456 | 3464 | $("#modelsettingsbackground").css("display", "none"); |
3457 | 3465 | // $("#setting-spinner").css("display", "none"); |
3458 | 3466 | $("#setting-spinner").css("display", "block"); |
3467 | + | |
3459 | 3468 | $rootScope.lexiconLanguageArrayLength = $rootScope.lexiconLanguageArray.length; |
3460 | 3469 | |
3461 | 3470 | // }, 6000); |
... | ... | @@ -3463,21 +3472,31 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
3463 | 3472 | |
3464 | 3473 | |
3465 | 3474 | $rootScope.CloseSettingPopup = function () { |
3466 | - $rootScope.deSelectLanguageOptions(); | |
3475 | + if ($rootScope.isApplyBtnClicked == false) { | |
3476 | + $rootScope.deSelectLanguageOptions(); | |
3477 | + } | |
3478 | + else { | |
3479 | + $rootScope.isApplyBtnClicked = false; | |
3480 | + } | |
3467 | 3481 | $('#modal-settings').css("display", "none"); |
3468 | 3482 | $("#modelsettingsbackground").css("display", "none"); |
3469 | 3483 | } |
3470 | 3484 | |
3471 | 3485 | $rootScope.deSelectLanguageOptions = function () { |
3472 | - if ($rootScope.lexiconLanguageArrayLength < $rootScope.lexiconLanguageArray.length) { | |
3473 | - | |
3486 | + | |
3474 | 3487 | var languageDifference = ($rootScope.lexiconLanguageArrayLength) - ($rootScope.lexiconLanguageArray.length); |
3475 | - | |
3476 | 3488 | if (languageDifference > 0) { |
3477 | - // alert("positive value") | |
3489 | + for (var i = 0; i <= $rootScope.lexiconRemovedLanguage.length - 1; i++) { | |
3490 | + $("#lexiconLangDropdown option").each(function () { | |
3491 | + if ($rootScope.lexiconRemovedLanguage[i].language == $(this).val()) { | |
3492 | + $(this).remove(); | |
3493 | + $('#secondLax').append('<option val="' + $rootScope.lexiconRemovedLanguage[i].id + '">' + $rootScope.lexiconRemovedLanguage[i].language + '</option>'); | |
3494 | + $rootScope.lexiconLanguageArray.push({ "id": $rootScope.lexiconRemovedLanguage[i].id, "language": $rootScope.lexiconRemovedLanguage[i].language }); | |
3495 | + } | |
3496 | + }); | |
3497 | + } | |
3478 | 3498 | } |
3479 | - else { | |
3480 | - | |
3499 | + else if (languageDifference < 0) { | |
3481 | 3500 | languageDifference = Math.abs(languageDifference); |
3482 | 3501 | for (var i = 1; i <= languageDifference; i++) { |
3483 | 3502 | var lexiconArrayLength = $rootScope.lexiconLanguageArray.length; |
... | ... | @@ -3492,8 +3511,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
3492 | 3511 | $rootScope.lexiconLanguageArray.pop(); |
3493 | 3512 | } |
3494 | 3513 | } |
3495 | - } | |
3496 | - | |
3514 | + | |
3497 | 3515 | |
3498 | 3516 | if ($rootScope.lexiconPrimaryLanguage == $("#primarylaxican").val()) { |
3499 | 3517 | // alert("same name"); |
... | ... | @@ -3512,8 +3530,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
3512 | 3530 | } |
3513 | 3531 | } |
3514 | 3532 | |
3515 | - | |
3533 | + | |
3516 | 3534 | $rootScope.UpdateSetting = function (setting) { |
3535 | + $rootScope.isApplyBtnClicked = true; | |
3517 | 3536 | var isReloadingViewRequired = false; |
3518 | 3537 | //1. |
3519 | 3538 | if (typeof (setting.ethnicity) !== "undefined" && setting.ethnicity !== null) { |
... | ... | @@ -3570,10 +3589,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
3570 | 3589 | } |
3571 | 3590 | else { |
3572 | 3591 | |
3573 | - $('#modal-settings').css("display", "none"); | |
3574 | - $("#modelsettingsbackground").css("display", "none"); | |
3592 | + // $('#modal-settings').css("display", "none"); | |
3593 | + // $("#modelsettingsbackground").css("display", "none"); | |
3575 | 3594 | } |
3576 | - | |
3595 | + $rootScope.lexiconRemovedLanguage = []; | |
3596 | + $("#secondLax option").each(function () { | |
3597 | + $rootScope.lexiconRemovedLanguage.push({ "id": $(this).attr("val"), "language": $(this).val() }); | |
3598 | + }); | |
3577 | 3599 | }; |
3578 | 3600 | |
3579 | 3601 | ... | ... |