-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Dialog Template can now thake an component and use it as its Footer. Support for the Notification Dialog has already been added Fixes #647
- Loading branch information
1 parent
58dd940
commit 8d94aa2
Showing
16 changed files
with
142 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Phonebook.Frontend/src/app/dialogs/dialog-footer/dialog-footer.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<template #footerContainer></template> |
Empty file.
25 changes: 25 additions & 0 deletions
25
Phonebook.Frontend/src/app/dialogs/dialog-footer/dialog-footer.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DialogFooterComponent } from './dialog-footer.component'; | ||
|
||
describe('DialogFooterComponent', () => { | ||
let component: DialogFooterComponent; | ||
let fixture: ComponentFixture<DialogFooterComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DialogFooterComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DialogFooterComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
Phonebook.Frontend/src/app/dialogs/dialog-footer/dialog-footer.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { | ||
Component, | ||
OnInit, | ||
Input, | ||
ViewChild, | ||
ViewContainerRef, | ||
ComponentRef, | ||
ComponentFactoryResolver, | ||
ChangeDetectorRef, | ||
ComponentFactory, | ||
} from '@angular/core'; | ||
import { DialogItem } from 'src/app/dialogs/dialog-item'; | ||
|
||
@Component({ | ||
selector: 'app-dialog-footer', | ||
templateUrl: './dialog-footer.component.html', | ||
styleUrls: ['./dialog-footer.component.scss'], | ||
}) | ||
export class DialogFooterComponent { | ||
@Input() public footer: DialogItem; | ||
@ViewChild('footerContainer', { read: ViewContainerRef }) container; | ||
public componentRef: ComponentRef<any>; | ||
|
||
constructor(private resolver: ComponentFactoryResolver, private cdRef: ChangeDetectorRef) {} | ||
ngAfterViewInit(): void { | ||
//Called after ngAfterContentInit when the component's view has been initialized. Applies to components only. | ||
//Add 'implements AfterViewInit' to the class. | ||
const factory: ComponentFactory<any> = this.resolver.resolveComponentFactory( | ||
this.footer.component | ||
); | ||
this.componentRef = this.container.createComponent(factory); | ||
this.cdRef.detectChanges(); | ||
} | ||
public createComponent() {} | ||
|
||
ngOnDestroy() { | ||
this.componentRef.destroy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...-notification-dialog/notification-dialog-footer/notification-dialog-footer.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<span i18n="Display-notificationDialog|Cookie notice@@WelcomeCookieNotice"> | ||
This site uses cookies to ensure the basic functionality of the app. | ||
</span> | ||
<span | ||
i18n="Display-notificationDialog|Annoyed by cookies notice@@PageInformationNewUrlNoCookiesText" | ||
> | ||
You deactivated cookies and keep getting those dialogs? | ||
</span> | ||
<button | ||
i18n="Display-notificationDialog|Deactivate Startup Dialogs@@PageInformationNewUrlNoCookiesButton" | ||
mat-button | ||
mat-dialog-close | ||
(click)="skipStartDialogs()" | ||
> | ||
Deactivate startup-dialogs! | ||
</button> |
Empty file.
25 changes: 25 additions & 0 deletions
25
...tification-dialog/notification-dialog-footer/notification-dialog-footer.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { NotificationDialogFooterComponent } from './notification-dialog-footer.component'; | ||
|
||
describe('NotificationDialogFooterComponent', () => { | ||
let component: NotificationDialogFooterComponent; | ||
let fixture: ComponentFixture<NotificationDialogFooterComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ NotificationDialogFooterComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(NotificationDialogFooterComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
...ay-notification-dialog/notification-dialog-footer/notification-dialog-footer.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Router } from '@angular/router'; | ||
|
||
@Component({ | ||
selector: 'app-notification-dialog-footer', | ||
templateUrl: './notification-dialog-footer.component.html', | ||
styleUrls: ['./notification-dialog-footer.component.scss'], | ||
}) | ||
export class NotificationDialogFooterComponent implements OnInit { | ||
constructor(private router: Router) {} | ||
|
||
public ngOnInit(): void {} | ||
public skipStartDialogs() { | ||
this.router.navigateByUrl('/?skip_dialog=true'); | ||
} | ||
} |