Updates to save viewport data across sessions / while switching tabs
This commit is contained in:
1 parent
56417df385
commit
4721400b34
27 files changed
+585
-204
No files matched your search
@@ -7,11 +7,13 @@ Template.tabTitle.events({
|
||||
var newActiveTabIndex = Math.max(tabIndex - 1, 0);
|
||||
var newActiveTab = $(".tabTitle").eq(newActiveTabIndex);
|
||||
var newActiveTabLink = newActiveTab.find("a[data-toggle=tab]");
|
||||
var newContentId = newActiveTabLink.data("target");
|
||||
var newContentId = newActiveTabLink.data("target").replace("#", "");
|
||||
|
||||
switchToTab(newContentId);
|
||||
|
||||
var tabObjectId = tabs.find({contentid: contentId}).fetch()[0]._id;
|
||||
tabs.remove(tabObjectId);
|
||||
|
||||
delete ViewerData[contentId];
|
||||
}
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="worklist">
|
||||
<ul class="nav" role="tablist" id="tablist">
|
||||
<ul class="nav noselect" role="tablist" id="tablist">
|
||||
<li role="presentation" class="tabTitle active">
|
||||
<a data-target="#worklistTab" role="tab" data-toggle="tab">Study List</a>
|
||||
</li>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
ViewerData = Session.get('ViewerData') || {};
|
||||
|
||||
Template.worklist.helpers({
|
||||
'tabs': function() {
|
||||
console.log('Updating tabs');
|
||||
@@ -7,29 +9,25 @@ Template.worklist.helpers({
|
||||
|
||||
Template.worklist.events({
|
||||
'click a[data-toggle="tab"]': function(e) {
|
||||
var contentId = $(e.currentTarget).data('target');
|
||||
var contentId = $(e.currentTarget).data('target').replace("#", "");
|
||||
switchToTab(contentId);
|
||||
}
|
||||
});
|
||||
|
||||
switchToTab = function(contentId) {
|
||||
var data = Session.get('DataInTab' + contentId);
|
||||
|
||||
var newContentId = contentId.replace("#", "");
|
||||
//var tabObject = tabs.findOne({contentid: newContentId});
|
||||
//tabObject.active = true;
|
||||
var data = ViewerData[contentId];
|
||||
|
||||
console.log("Switching to tab: " + contentId);
|
||||
$('.tabTitle a[data-target="' + contentId + '"]').tab('show');
|
||||
$('.tabTitle a[data-target="#' + contentId + '"]').tab('show');
|
||||
|
||||
$("#viewer").remove();
|
||||
|
||||
var container = $('.tab-content').find(contentId).get(0);
|
||||
var container = $('.tab-content').find("#" + contentId).get(0);
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (contentId === '#worklistTab') {
|
||||
if (contentId === 'worklistTab') {
|
||||
console.log('Switching to worklist');
|
||||
document.body.style.overflow = null;
|
||||
document.body.style.height = null;
|
||||
@@ -50,9 +48,28 @@ switchToTab = function(contentId) {
|
||||
|
||||
Template.worklist.onRendered(function() {
|
||||
this.autorun(function() {
|
||||
var contentId = Session.get('OpenNewTabEvent');
|
||||
if (contentId) {
|
||||
switchToTab("#" + contentId);
|
||||
var data = Session.get('OpenNewTabEvent');
|
||||
|
||||
// If we have no new tab data, stop here
|
||||
// (e.g. if we are rendering the worklist)
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
var contentId = data.contentid;
|
||||
if (ViewerData.hasOwnProperty(contentId)) {
|
||||
console.warn('Contentid already exists?');
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the viewer data object
|
||||
ViewerData[contentId] = {
|
||||
contentId: contentId,
|
||||
studies: data.studies,
|
||||
title: data.title
|
||||
};
|
||||
Session.set('ViewerData', ViewerData);
|
||||
|
||||
switchToTab(contentId);
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,13 @@
|
||||
body
|
||||
background-color: #202020
|
||||
|
||||
.noselect
|
||||
-webkit-touch-callout: none
|
||||
-webkit-user-select: none
|
||||
-khtml-user-select: none
|
||||
-moz-user-select: none
|
||||
-ms-user-select: none
|
||||
user-select: none
|
||||
|
||||
#worklistTab
|
||||
background-color: #202020
|
||||
|
||||
Reference in new issue
Block a user