ohif-viewer/Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.js
Evren Ozkan 9544a24ed8 Fix hanging protocol bugs
- Convert series number and instance number to integer in imageDetails.sortingInfo to sort the images properly (e.g. 1,2,10 instead of 1,10,2)
- Sort based on firstly instanceNumber, then seriesNumber, to show the first instance of the next series in the next viewport instead of the second instance of the previous series in multiple layout (other than 1x1)
- Do nothing when clicked if the previous and next stage buttons are disabled
- Add forgotten undefined check statements
2016-11-14 13:19:20 -05:00

45 lines
1.3 KiB
JavaScript

Template.nextPresentationGroupButton.helpers({
/**
* Check if a later stage exists for the user to switch to
*
* @returns {boolean} Whether or not a later stage exists
*/
nextNotAvailable() {
// Run this helper whenever the ProtocolEngine / LayoutManager has changed
Session.get('LayoutManagerUpdated');
// If no ProtocolEngine has been defined yet, stop here
if (!ProtocolEngine) {
return;
}
// Return whether or not the current stage is the last stage
return ProtocolEngine.stage === ProtocolEngine.getNumProtocolStages() - 1;
}
});
Template.nextPresentationGroupButton.events({
/**
* Switch to the next Presentation group
*
* @param event The click event on the button
*/
'click #nextPresentationGroup'(event) {
// If no ProtocolEngine has been defined yet, do nothing
if (!ProtocolEngine) {
return;
}
// Stop here if the tool is disabled
if ($(event.currentTarget).hasClass('disabled')) {
return;
}
// Hide the button's Bootstrap tooltip in case it was shown
$(event.currentTarget).tooltip('hide');
// Instruct the ProtocolEngine to switch to the next stage
ProtocolEngine.nextProtocolStage();
}
});