From ecbfed13fe294afd4da8c9ea624b5a5962708db7 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 4 Jul 2022 14:29:47 +0300 Subject: [PATCH] customization: add alert for unsaved changes --- .../customization/customization.component.html | 1 + .../pages/customization/customization.component.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/pages/customization/customization.component.html b/src/app/pages/customization/customization.component.html index dfa78e8..b757f68 100644 --- a/src/app/pages/customization/customization.component.html +++ b/src/app/pages/customization/customization.component.html @@ -305,3 +305,4 @@ + diff --git a/src/app/pages/customization/customization.component.ts b/src/app/pages/customization/customization.component.ts index f9ded2c..68be4c7 100644 --- a/src/app/pages/customization/customization.component.ts +++ b/src/app/pages/customization/customization.component.ts @@ -15,6 +15,7 @@ import {Subscription} from 'rxjs'; import {FullScreenModalComponent} from "../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component"; import {UserManagementService} from "../../openaireLibrary/services/user-management.service"; import {MenuItem} from "../../openaireLibrary/sharedComponents/menu"; +import {AlertModal} from "../../openaireLibrary/utils/modal/alert"; declare var UIkit; @@ -77,6 +78,7 @@ export class CustomizationComponent implements OnInit { sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" }, {name:"Backgrounds", id : "backgrounds", icon: "wallpaper" }, {name:"Buttons", id : "buttons", icon: "smart_button" }] + @ViewChild('leaveModal') closeModal: AlertModal; constructor(private element: ElementRef, private route: ActivatedRoute, @@ -290,7 +292,16 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" }, if(!this.hasChanges(this.publishedCustomizationOptions, this.draftCustomizationOptions)) { this._router.navigate(["../info/profile"], {relativeTo: this.route}); }else{ - alert("TODO " + "Changes that you made may not be saved."+" Με buttons από κάτω cancel (αριστερά) και leave (δεξιά)"); + this.closeModal.alertTitle = "Discard changes"; + this.closeModal.message = "Unsaved changes will be lost."; + this.closeModal.okButtonText = "Leave"; + this.closeModal.cancelButtonText = "Cancel"; + this.closeModal.okButtonLeft = false; + this.closeModal.open(); } } + + confirmClose(){ + this._router.navigate(["../info/profile"], {relativeTo: this.route}); + } }