fix(hot-keys): Set the correct context name to enable hot keys based on the current page (#308)

This commit is contained in:
Evren Ozkan committed 2018-11-09 13:14:03 -05:00
1 parent 99041bebde
commit 5017fd13af
7 files changed
+25 -16

No files matched your search

-1
View File
@@ -1,2 +1 @@
import './components';
import './lib';
@@ -1 +0,0 @@
import './routes';
@@ -1,14 +0,0 @@
import { Router } from 'meteor/clinical:router';
import { Session } from 'meteor/session';
import { hotkeys } from 'meteor/ohif:hotkeys';
Router.onBeforeAction(function() {
const lastRoute = Session.get('lastRoute');
const currentRoute = this.router.current().route.getName();
if (currentRoute !== lastRoute) {
hotkeys.switchToContext(null);
Session.set('lastRoute', currentRoute);
}
this.next();
});
@@ -1,4 +1,5 @@
import './studylist.html';
import './studylist.js';
import './studylist.styl';
import './studylistStudy/studylistStudy.html';
@@ -0,0 +1,12 @@
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
Template.studylist.onCreated(() => {
// Set the current context
OHIF.context.set('studylist');
});
Template.studylist.onDestroyed(() => {
// Reset the current context
OHIF.context.set(null);
});
@@ -28,6 +28,9 @@ Template.viewerMain.onCreated(() => {
// Add beforeUnload event handler to check for unsaved changes
window.addEventListener('beforeunload', unloadHandlers.beforeUnload);
// Set the current context
OHIF.context.set('viewer');
});
Template.viewerMain.onRendered(() => {
@@ -82,4 +85,7 @@ Template.viewerMain.onDestroyed(() => {
// @TypeSafeStudies
// Clears OHIF.viewer.StudyMetadataList collection
OHIF.viewer.StudyMetadataList.removeAll();
// Reset the current context
OHIF.context.set(null);
});