Opening series sidebar by default

This commit is contained in:
Bruno Alves de Faria 2016-08-20 10:09:31 -03:00
parent 0dfb3cc824
commit 479e420179
14 changed files with 68 additions and 48 deletions

View File

@ -1,4 +1,14 @@
import { OHIF } from 'meteor/ohif:core'; import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { $ } from 'meteor/jquery';
Template.toolbarSection.onCreated(() => {
const instance = Template.instance();
if (OHIF.uiSettings.leftSidebarOpen) {
instance.data.state.set('leftSidebar', 'studies');
}
});
Template.toolbarSection.helpers({ Template.toolbarSection.helpers({
leftSidebarToggleButtonData() { leftSidebarToggleButtonData() {

View File

@ -1,5 +1,5 @@
<template name="lesionTrackerWorklistContextMenu"> <template name="lesionTrackerWorklistContextMenu">
{{#if studyListFunctionsEnabled}} {{#if uiSettings.studyListFunctionsEnabled}}
<div id="studyContextMenu" class="studyContextMenu noselect" <div id="studyContextMenu" class="studyContextMenu noselect"
oncontextmenu='return false;' oncontextmenu='return false;'
unselectable='on' unselectable='on'

View File

@ -173,11 +173,3 @@ function viewStudies() {
// Switch to the new tab // Switch to the new tab
switchToTab(contentid); switchToTab(contentid);
} }
Template.studyContextMenu.helpers({
'studyListFunctionsEnabled': function() {
var studyListFunctionsEnabled = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui &&
Meteor.settings.public.ui.studyListFunctionsEnabled || false;
return studyListFunctionsEnabled;
}
});

View File

@ -5,3 +5,4 @@ import './logical.js';
import './number.js'; import './number.js';
import './string.js'; import './string.js';
import './typing.js'; import './typing.js';
import './ui.js';

View File

@ -0,0 +1,11 @@
import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
/**
* Global Blaze UI helpers
*/
// Access OHIF.uiSettings object
Template.registerHelper('uiSettings', () => {
return OHIF.uiSettings;
});

View File

@ -1,3 +1,4 @@
import './blaze.js'; import './blaze.js';
import './string.js'; import './string.js';
import './ui.js';
import './user.js'; import './user.js';

View File

@ -0,0 +1,6 @@
import { OHIF } from 'meteor/ohif:core';
import { Meteor } from 'meteor/meteor';
// Get the UI settings
const ui = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui;
OHIF.uiSettings = ui || {};

View File

@ -116,6 +116,11 @@ export const UISettings = new SimpleSchema({
type: Boolean, type: Boolean,
label: 'Study List Functions Enabled?', label: 'Study List Functions Enabled?',
defaultValue: true defaultValue: true
},
leftSidebarOpen: {
type: Boolean,
label: 'Left sidebar open by default?',
defaultValue: false
} }
}); });

View File

@ -1,5 +1,5 @@
<template name="studyContextMenu"> <template name="studyContextMenu">
{{#if studyListFunctionsEnabled}} {{#if uiSettings.studyListFunctionsEnabled}}
<div id="studyContextMenu" class="studyContextMenu noselect" <div id="studyContextMenu" class="studyContextMenu noselect"
oncontextmenu='return false;' oncontextmenu='return false;'
unselectable='on' unselectable='on'

View File

@ -82,10 +82,3 @@ Template.studyContextMenu.events({
closeHandler(dialog); closeHandler(dialog);
} }
}); });
Template.studyContextMenu.helpers({
'studyListFunctionsEnabled': function() {
var studyListFunctionsEnabled = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui &&
Meteor.settings.public.ui.studyListFunctionsEnabled || false; return studyListFunctionsEnabled;
}
});

View File

@ -1,3 +1,9 @@
import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { $ } from 'meteor/jquery';
Template.worklistToolbar.onCreated(() => { Template.worklistToolbar.onCreated(() => {
Meteor.call('importSupported', (error, result) => { Meteor.call('importSupported', (error, result) => {
if (error || !result) { if (error || !result) {
@ -11,26 +17,20 @@ Template.worklistToolbar.onCreated(() => {
Template.worklistToolbar.events({ Template.worklistToolbar.events({
'change .js-import-files'(event) { 'change .js-import-files'(event) {
// Get selected files located in the client machine // Get selected files located in the client machine
var selectedFiles = $.map(event.currentTarget.files, (value) => { const selectedFiles = $.map(event.currentTarget.files, value => value);
return value;
});
importStudies(selectedFiles); importStudies(selectedFiles);
}, },
'click .js-import-files'(event) { 'click .js-import-files'(event) {
// Reset file input // Reset file input
var fileInput = event.currentTarget; $(event.currentTarget).val('');
$(fileInput).val('');
} }
}); });
Template.worklistToolbar.helpers({ Template.worklistToolbar.helpers({
importSupported() { importSupported() {
var importSupported = Session.get('importSupported'); const importSupported = Session.get('importSupported');
var studyListFunctionsEnabled = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui && return (importSupported && OHIF.uiSettings.studyListFunctionsEnabled);
Meteor.settings.public.ui.studyListFunctionsEnabled || false;
return (importSupported && studyListFunctionsEnabled);
} }
}); });

View File

@ -22,7 +22,8 @@
"public": { "public": {
"verifyEmail": false, "verifyEmail": false,
"ui": { "ui": {
"studyListFunctionsEnabled": true "studyListFunctionsEnabled": true,
"leftSidebarOpen": true
} }
} }
} }