LT-381: Disabling save button until there are unsaved changes

This commit is contained in:
Bruno Alves de Faria 2016-11-22 17:21:05 -02:00
parent 9fc538d5d4
commit 3eae1c6878
2 changed files with 9 additions and 1 deletions

View File

@ -10,7 +10,7 @@
{{/if}}
{{#if progressComplete}}
<div class="caseProgressStatus">
<button class="btn js-finish-case">Save</button>
<button class="btn js-finish-case {{valueIf isFinishDisabled 'disabled' ''}}">Save</button>
</div>
{{/if}}
</div>

View File

@ -1,5 +1,6 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
import { OHIF } from 'meteor/ohif:core';
Template.caseProgress.onCreated(() => {
@ -150,6 +151,13 @@ Template.caseProgress.helpers({
const progressPercent = instance.progressPercent.get();
return progressPercent === 100;
},
isFinishDisabled() {
// Run this computation every time any measurement / timepoint suffer changes
Session.get('LayoutManagerUpdated');
return OHIF.ui.unsavedChanges.probe('viewer.*') === 0;
}
});