PWV-1: Refactoring ohif:studylist package

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-11-15 08:24:01 +01:00
1 parent 984ef94403
commit 4d79bf84a8
79 files changed
+450 -551

No files matched your search

@@ -0,0 +1,12 @@
<template name="studylistToolbar">
<div class='studylistToolbar'>
{{#if importSupported }}
<div class="addNewStudy btn-file">
<label for="btnImport">
<i class="fa fa-plus"></i> Add new study
</label>
<input id="btnImport" class='js-import-files' type="file" webkitdirectory directory multiple>
</div>
{{/if }}
</div>
</template>
@@ -0,0 +1,36 @@
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.studylistToolbar.onCreated(() => {
Meteor.call('importSupported', (error, result) => {
if (error || !result) {
Session.set('importSupported', false);
} else {
Session.set('importSupported', true);
}
});
});
Template.studylistToolbar.events({
'change .js-import-files'(event) {
// Get selected files located in the client machine
const selectedFiles = $.map(event.currentTarget.files, value => value);
importStudies(selectedFiles);
},
'click .js-import-files'(event) {
// Reset file input
$(event.currentTarget).val('');
}
});
Template.studylistToolbar.helpers({
importSupported() {
const importSupported = Session.get('importSupported');
return (importSupported && OHIF.uiSettings.studyListFunctionsEnabled);
}
});
@@ -0,0 +1,27 @@
@import "{design}/app"
.studylistToolbar
.addNewStudy
margin: 0 10px
label
theme('color', '$textSecondaryColor')
font-weight: 400
cursor: pointer
*
pointer-events: none
&:hover
theme('color', '$hoverColor')
&:active
theme('color', '$activeColor')
input
width: 0.1px;
height: 0.1px
opacity: 0
overflow: hidden
position: absolute
z-index: -1