Minor improvements on notifications mechanism

This commit is contained in:
Bruno Alves de Faria 2017-09-29 14:01:39 -03:00
parent 4efa774cd3
commit 7641d6e9af
4 changed files with 9 additions and 5 deletions

View File

@ -14,7 +14,7 @@
{{#unless this.hideCancel}} {{#unless this.hideCancel}}
{{#button action='cancel' {{#button action='cancel'
disabled=this.cancelDisabled 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') tagAttributes=(extend this.tagAttributes data-dismiss='modal')
}}{{choose this.cancelLabel 'Cancel'}}{{/button}} }}{{choose this.cancelLabel 'Cancel'}}{{/button}}
{{/unless}} {{/unless}}

View File

@ -104,4 +104,9 @@ Notifications.show = ({ template, data, text, style, timeout=5000, promise }) =>
return notificationPromise; 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; OHIF.ui.notifications = Notifications;

View File

@ -15,7 +15,7 @@
<div class="form-buttons clearfix"> <div class="form-buttons clearfix">
{{#button class='btn btn-danger pull-left' action='resetDefaults'}}Reset to Defaults{{/button}} {{#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-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}}
</div> </div>
{{/form}} {{/form}}
</template> </template>

View File

@ -12,9 +12,8 @@ Template.hotkeysForm.onCreated(() => {
const form = instance.$('form').first().data('component'); const form = instance.$('form').first().data('component');
const definitions = form.value(); const definitions = form.value();
const promise = OHIF.hotkeys.store(contextName, definitions); const promise = OHIF.hotkeys.store(contextName, definitions);
promise.then(() => OHIF.ui.notifications.show({ promise.then(() => OHIF.ui.notifications.success({
text: 'The keyboard shortcut preferences were successfully saved.', text: 'The keyboard shortcut preferences were successfully saved.'
style: 'success'
})); }));
return promise; return promise;
}, },