From 7641d6e9af059820ee3c9abb1091d070b8a00e5a Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Fri, 29 Sep 2017 14:01:39 -0300 Subject: [PATCH] Minor improvements on notifications mechanism --- .../ohif-core/client/components/bootstrap/dialog/form.html | 2 +- Packages/ohif-core/client/ui/notifications/notifications.js | 5 +++++ Packages/ohif-hotkeys/client/components/form.html | 2 +- Packages/ohif-hotkeys/client/components/form.js | 5 ++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/form.html b/Packages/ohif-core/client/components/bootstrap/dialog/form.html index 8f2251c81..cfcade9f5 100644 --- a/Packages/ohif-core/client/components/bootstrap/dialog/form.html +++ b/Packages/ohif-core/client/components/bootstrap/dialog/form.html @@ -14,7 +14,7 @@ {{#unless this.hideCancel}} {{#button action='cancel' disabled=this.cancelDisabled - class=(concat 'btn btn-cancel ' (choose this.cancelClass 'btn-default')) + class=(concat 'btn btn-cancel ' (choose this.cancelClass 'btn-secondary')) tagAttributes=(extend this.tagAttributes data-dismiss='modal') }}{{choose this.cancelLabel 'Cancel'}}{{/button}} {{/unless}} diff --git a/Packages/ohif-core/client/ui/notifications/notifications.js b/Packages/ohif-core/client/ui/notifications/notifications.js index be73775c4..d52383bbb 100644 --- a/Packages/ohif-core/client/ui/notifications/notifications.js +++ b/Packages/ohif-core/client/ui/notifications/notifications.js @@ -104,4 +104,9 @@ Notifications.show = ({ template, data, text, style, timeout=5000, promise }) => return notificationPromise; }; +Notifications.info = o => Notifications.show(Object.assign({}, o, { style: 'info' })); +Notifications.success = o => Notifications.show(Object.assign({}, o, { style: 'success' })); +Notifications.warning = o => Notifications.show(Object.assign({}, o, { style: 'warning' })); +Notifications.danger = o => Notifications.show(Object.assign({}, o, { style: 'danger' })); + OHIF.ui.notifications = Notifications; diff --git a/Packages/ohif-hotkeys/client/components/form.html b/Packages/ohif-hotkeys/client/components/form.html index 6fd147fd5..8487288d5 100644 --- a/Packages/ohif-hotkeys/client/components/form.html +++ b/Packages/ohif-hotkeys/client/components/form.html @@ -15,7 +15,7 @@
{{#button class='btn btn-danger pull-left' action='resetDefaults'}}Reset to Defaults{{/button}} {{#button class='btn btn-primary pull-right' action='save'}}Save{{/button}} - {{#button class='btn btn-default pull-right m-r-1' tagAttributes=(extend '' data-dismiss='modal')}}Close{{/button}} + {{#button class='btn btn-secondary pull-right m-r-1' tagAttributes=(extend '' data-dismiss='modal')}}Close{{/button}}
{{/form}} diff --git a/Packages/ohif-hotkeys/client/components/form.js b/Packages/ohif-hotkeys/client/components/form.js index 47a9ef790..b5de9002b 100644 --- a/Packages/ohif-hotkeys/client/components/form.js +++ b/Packages/ohif-hotkeys/client/components/form.js @@ -12,9 +12,8 @@ Template.hotkeysForm.onCreated(() => { const form = instance.$('form').first().data('component'); const definitions = form.value(); const promise = OHIF.hotkeys.store(contextName, definitions); - promise.then(() => OHIF.ui.notifications.show({ - text: 'The keyboard shortcut preferences were successfully saved.', - style: 'success' + promise.then(() => OHIF.ui.notifications.success({ + text: 'The keyboard shortcut preferences were successfully saved.' })); return promise; },