Adding reset to defaults button

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2017-06-14 09:19:49 +02:00
1 parent a77838d550
commit 22f1e659fa
7 files changed
+94 -40

No files matched your search

@@ -4,6 +4,9 @@
{{>inputText (extend hotkeyInputInformation class='hotkey')}}
{{/each}}
<hr>
{{#button class='btn btn-primary' action='save'}}Save{{/button}}
<div class="clearfix">
{{#button class='btn btn-primary pull-right' action='save'}}Save{{/button}}
{{#button class='btn btn-secondary pull-right m-r-1' action='resetDefaults'}}Reset to Defaults{{/button}}
</div>
{{/form}}
</template>
@@ -12,7 +12,19 @@ Template.hotkeysForm.onCreated(() => {
const { contextName } = instance.data;
const form = instance.$('form').first().data('component');
const definitions = form.value();
OHIF.hotkeys.store(contextName, definitions);
return OHIF.hotkeys.store(contextName, definitions);
},
resetDefaults() {
const { contextName } = instance.data;
const dialogOptions = {
title: 'Reset Shortcuts to Default',
message: 'Are you sure you want to reset all the shortcuts to their defaults?'
};
return OHIF.ui.showDialog('dialogConfirm', dialogOptions).then(() => {
return OHIF.hotkeys.resetDefauls(contextName);
});
}
};
@@ -100,7 +112,7 @@ Template.hotkeysForm.events({
Template.hotkeysForm.helpers({
getHotkeyInputInformationList() {
OHIF.context.dep.depend();
OHIF.hotkeys.changeObserver.depend();
const instance = Template.instance();
const { contextName } = instance.data;
const hotkeysInputInformation = [];