From 6fef754651477e078c6a9a36530e8f518d449460 Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Fri, 29 Sep 2017 13:08:26 -0300 Subject: [PATCH] Allowing custom templates inside notification note --- .../bootstrap/notification/notificationArea.styl | 12 ++++++++++-- .../bootstrap/notification/notificationNote.html | 8 +++++++- .../client/ui/notifications/notifications.js | 4 +++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Packages/ohif-core/client/components/bootstrap/notification/notificationArea.styl b/Packages/ohif-core/client/components/bootstrap/notification/notificationArea.styl index c7b3b8790..31bc99571 100644 --- a/Packages/ohif-core/client/components/bootstrap/notification/notificationArea.styl +++ b/Packages/ohif-core/client/components/bootstrap/notification/notificationArea.styl @@ -25,7 +25,7 @@ position: relative &:not(.hide-dismiss) - padding-right: 40px + padding-right: 50px .note-dismiss display: block @@ -46,9 +46,17 @@ position: absolute text-align: center top: 50% - transform(translateY(-50%)) + transform(translateY(-50%) rotate(0deg)) + transform-origin(50% 50%) + transition(transform 0.3s ease) width: 100% + &:hover + background: rgba(0, 0, 0, 0.1) + + i + transform(translateY(-50%) rotate(180deg)) + &.in max-height: auto opacity: 1 diff --git a/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.html b/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.html index 72c244bf8..a11f42c43 100644 --- a/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.html +++ b/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.html @@ -2,7 +2,13 @@
-
{{this.text}}
+
+ {{#if this.template}} + {{>Template.dynamic template=this.template data=(choose this.templateData this)}} + {{else}} + {{this.text}} + {{/if}} +
diff --git a/Packages/ohif-core/client/ui/notifications/notifications.js b/Packages/ohif-core/client/ui/notifications/notifications.js index 57fb9e205..be73775c4 100644 --- a/Packages/ohif-core/client/ui/notifications/notifications.js +++ b/Packages/ohif-core/client/ui/notifications/notifications.js @@ -37,7 +37,7 @@ Notifications.dismiss = id => { Notifications.clear = () => Array.from(Notifications.views.keys()).forEach(Notifications.dismiss); // Display a notification note -Notifications.show = ({ template, promise, text, style, timeout=5000 }) => { +Notifications.show = ({ template, data, text, style, timeout=5000, promise }) => { // Check if the given template exists const templateObject = Template[template]; if (template && !templateObject) { @@ -52,6 +52,8 @@ Notifications.show = ({ template, promise, text, style, timeout=5000 }) => { let notificationPromise; let templateData = { + template, + data, text, style, timeout,