LT-249: Changing sidebar width when timepoints count is changed

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-07-22 11:08:27 +02:00
1 parent 7cb8ed6c9f
commit c65e8861b0
5 files changed
+72 -59

No files matched your search

@@ -28,6 +28,27 @@ Template.lesionTable.onCreated(() => {
});
});
Template.lesionTable.onRendered(() => {
const instance = Template.instance();
instance.autorun(() => {
// Run this computation everytime the lesion table layout is changed
instance.data.lesionTableLayout.dep.depend();
if(instance.data.state.get('rightSidebar') !== 'lesions') {
// Remove the amount attribute from sidebar element tag
instance.$('#lesionTableContainer').closest('.sidebarMenu').removeAttr('data-timepoints');
return;
}
// Get the amount of timepoints being shown
const timepointAmount = instance.data.timepoints.get().length;
// Set the amount in an attribute on sidebar element tag
instance.$('#lesionTableContainer').closest('.sidebarMenu').attr('data-timepoints', timepointAmount);
});
});
// Temporary until we have a real window manager with events for series/study changed
Session.setDefault('NewSeriesLoaded', false);