diff --git a/frontend/riskofbias/robStudyForm/Root.js b/frontend/riskofbias/robStudyForm/Root.js index cbd2e070b1..424e8bf519 100644 --- a/frontend/riskofbias/robStudyForm/Root.js +++ b/frontend/riskofbias/robStudyForm/Root.js @@ -29,15 +29,35 @@ class Root extends Component { })}
- - + {store.changedSavedDiv ? ( +
+

+ + Changes saved! +

+
+ ) : null} +
+ +
+ + +
+
diff --git a/frontend/riskofbias/robStudyForm/store.js b/frontend/riskofbias/robStudyForm/store.js index fcc98b1e3d..11f82c99ef 100644 --- a/frontend/riskofbias/robStudyForm/store.js +++ b/frontend/riskofbias/robStudyForm/store.js @@ -142,7 +142,7 @@ class RobFormStore extends StudyRobStore { @action.bound cancelSubmitScores() { window.location.href = this.config.cancelUrl; } - @action.bound submitScores() { + @action.bound submitScores(redirect) { const payload = { id: this.config.riskofbias.id, scores: this.editableScores.map(score => { @@ -172,7 +172,11 @@ class RobFormStore extends StudyRobStore { return fetch(url, opts) .then(response => { if (response.ok) { - window.location.href = this.config.cancelUrl; + if (redirect) { + window.location.href = this.config.cancelUrl; + } else { + this.setChangedSavedDiv(); + } } else { response.text().then(text => { this.error = text; @@ -183,6 +187,13 @@ class RobFormStore extends StudyRobStore { this.error = error; }); } + @observable changedSavedDiv = false; + @action.bound setChangedSavedDiv() { + this.changedSavedDiv = true; + setTimeout(() => { + this.changedSavedDiv = false; + }, 2000); + } @action.bound createScoreOverride(payload) { let url = `${this.config.riskofbias.scores_url}?assessment_id=${this.config.assessment_id}`, csrf = this.config.csrf,