From 360784c1bb1104834011565a84d75e5d9360ea93 Mon Sep 17 00:00:00 2001 From: Andrea Chiapparelli - 4Science Date: Fri, 9 Mar 2018 12:53:04 +0100 Subject: [PATCH] flex --- .../models/notification.model.ts | 12 +- .../notification/notification.component.html | 151 +++++++++++++----- .../notification/notification.component.scss | 13 +- .../notification/notification.component.ts | 8 +- 4 files changed, 130 insertions(+), 54 deletions(-) diff --git a/src/app/shared/notifications/models/notification.model.ts b/src/app/shared/notifications/models/notification.model.ts index cafd5513ae..938bd3c5a9 100644 --- a/src/app/shared/notifications/models/notification.model.ts +++ b/src/app/shared/notifications/models/notification.model.ts @@ -6,8 +6,8 @@ import { Observable } from 'rxjs/Observable'; export interface INotification { id: string; type: NotificationType; - title?: Observable; - content?: Observable; + title?: Observable | string; + content?: Observable | string; options?: INotificationOptions; html?: any; } @@ -15,15 +15,15 @@ export interface INotification { export class Notification implements INotification { public id: string; public type: NotificationType; - public title: Observable; - public content: Observable; + public title: Observable | string; + public content: Observable | string; public options: INotificationOptions; public html: any; constructor(id: string, type: NotificationType, - title?: Observable, - content?: Observable, + title?: Observable | string, + content?: Observable | string, options?: NotificationOptions, html?: any) { diff --git a/src/app/shared/notifications/notification/notification.component.html b/src/app/shared/notifications/notification/notification.component.html index bb57714db8..d0fa5e0e87 100644 --- a/src/app/shared/notifications/notification/notification.component.html +++ b/src/app/shared/notifications/notification/notification.component.html @@ -1,55 +1,118 @@ diff --git a/src/app/shared/notifications/notification/notification.component.scss b/src/app/shared/notifications/notification/notification.component.scss index 8c4933d3e6..318153add8 100644 --- a/src/app/shared/notifications/notification/notification.component.scss +++ b/src/app/shared/notifications/notification/notification.component.scss @@ -1,10 +1,19 @@ +.alert-dismissible .close { + top: -13px; + right: -15px; +} + .notificationClose:focus { outline: none !important; } .icon { - float: left; - padding: 5px; + //float: left; + //padding: 5px; +} + +.alert-dismissible { + padding: 10px; } .sn-title, .sn-content, .sn-html { diff --git a/src/app/shared/notifications/notification/notification.component.ts b/src/app/shared/notifications/notification/notification.component.ts index cd0bba30c2..04fadf4941 100644 --- a/src/app/shared/notifications/notification/notification.component.ts +++ b/src/app/shared/notifications/notification/notification.component.ts @@ -127,8 +127,12 @@ export class NotificationComponent implements OnInit, OnDestroy { private contentType(item: any, key: string) { if (item instanceof TemplateRef) { this[key] = item; - } else if (key === 'title' || key === 'content' ) { - this[key] = isNotEmpty(item) ? item : Observable.of(''); + } else if (key === 'title' || key === 'content') { + this[key] = isNotEmpty(item) ? + typeof item === 'string' ? + Observable.of(item) + : typeof item === 'object' && isNotEmpty(item.payload) ? Observable.of(item.payload) : null + : null; } else { this[key] = this.domSanitizer.bypassSecurityTrustHtml(item); }