From 74bcc96847727ef76e23f93f68276745d62950dd Mon Sep 17 00:00:00 2001 From: Alex-Coded4 Date: Mon, 11 Jul 2022 10:25:00 +0300 Subject: [PATCH 1/2] start on new featured menu items --- dashboard/menu/menu.component.html | 149 +++++++++++------- dashboard/menu/menu.component.ts | 35 +++- .../admin-tabs/admin-tabs.component.ts | 4 +- 3 files changed, 123 insertions(+), 65 deletions(-) diff --git a/dashboard/menu/menu.component.html b/dashboard/menu/menu.component.html index b019e040..f6a44d3d 100644 --- a/dashboard/menu/menu.component.html +++ b/dashboard/menu/menu.component.html @@ -1,5 +1,19 @@ -
-
+
+
+
+ + + +
+
Admin Dashboard - Manage Menu Items
+

{{name ? name : 'Super Admin'}}

+
+
+
+ +
+
+
-
- -
-
- ` From cfd44ec96b3183b702eb37fedbfa8e4dd56fd0b8 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 11 Jul 2022 17:27:44 +0300 Subject: [PATCH 2/2] [Library | new-theme]: full-screen-modal.component.ts & alert.ts: [Bug fix] Added private static counter field to increase on each modal creation and set id according to the counter, to delete from DOM in "modal-container" the destroyed modal. --- utils/modal/alert.ts | 22 +++++++++++++++++-- .../full-screen-modal.component.ts | 21 ++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/utils/modal/alert.ts b/utils/modal/alert.ts index 7e325f05..2f9df9bd 100644 --- a/utils/modal/alert.ts +++ b/utils/modal/alert.ts @@ -49,7 +49,9 @@ declare var UIkit: any; * API to an open alert window. */ export class AlertModal { - @Input() id: string = "modal"; + private static MODAL_COUNTER: number = 0; + + id: string = "modal"; @Input() classTitle: string = "uk-background-primary-opacity"; @Input() classBody: string = ""; @Input() large: boolean = false; @@ -137,7 +139,23 @@ export class AlertModal { constructor() { } - + + ngOnInit() { + AlertModal.MODAL_COUNTER++; + this.id = 'modal-' + AlertModal.MODAL_COUNTER; + } + + ngOnDestroy() { + if(typeof document !== "undefined") { + const element = document.getElementById("modal-container"); + for (let i = element.childNodes.length - 1; i >= 0; --i) { + let child: ChildNode = element.childNodes[i]; + if (child['id'] == this.id) { + child.remove(); + } + } + } + } /** * Opens an alert window creating backdrop. diff --git a/utils/modal/full-screen-modal/full-screen-modal.component.ts b/utils/modal/full-screen-modal/full-screen-modal.component.ts index 15b4a144..4fb4de5b 100644 --- a/utils/modal/full-screen-modal/full-screen-modal.component.ts +++ b/utils/modal/full-screen-modal/full-screen-modal.component.ts @@ -51,7 +51,9 @@ declare var ResizeObserver; ` }) export class FullScreenModalComponent implements AfterViewInit, OnDestroy { - @Input() id: string = "fs-modal"; + private static FS_MODAL_COUNTER: number = 0; + + id: string = "fs-modal"; @Input() classTitle: string = "uk-background-primary uk-light"; @Input() classBody: string = 'uk-container-large'; back: boolean = false; @@ -78,7 +80,12 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy { onResize() { this.changeHeight(); } - + + ngOnInit() { + FullScreenModalComponent.FS_MODAL_COUNTER++; + this.id = 'fs-modal-' + FullScreenModalComponent.FS_MODAL_COUNTER; + } + ngAfterViewInit() { if(typeof window !== "undefined") { this.observer = new ResizeObserver(entries => { @@ -102,6 +109,16 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy { if(this.observer && this.observer instanceof ResizeObserver) { this.observer.disconnect(); } + if(typeof document !== "undefined") { + const element = document.getElementById("modal-container"); + for (let i = element.childNodes.length - 1; i >= 0; --i) { + let child: ChildNode = element.childNodes[i]; + if (child['id'] == this.id) { + child.remove(); + } + } + } + } get isOpen() {