Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #665 from theywa/local-664
Browse files Browse the repository at this point in the history
fixed: do not show 'saving is disabled' on form previews, #647
  • Loading branch information
kkrumlian authored Mar 16, 2023
2 parents 711462c + c448526 commit 7cc3142
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
5 changes: 4 additions & 1 deletion public/js/src/module/controller-webform-oc.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ function init(formEl, data, loadErrors = []) {
form = new Form(formEl, data, formOptions);
replaceModelMediaSources(form, media);

fieldSubmissionQueue = new FieldSubmissionQueue();
fieldSubmissionQueue = new FieldSubmissionQueue({
showStatus:
settings.type !== 'view' && settings.type !== 'preview',
});

// Buffer inputupdate events (DURING LOAD ONLY), in order to eventually log these
// changes in the DN widget after it has been initalized
Expand Down
30 changes: 16 additions & 14 deletions public/js/src/module/field-submission-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const FIELDSUBMISSION_COMPLETE_URL = settings.enketoId
: null;

class FieldSubmissionQueue {
constructor() {
constructor(options = { showStatus: true }) {
this.submissionQueue = {};
this.submissionOngoing = null;
this.lastAdded = {};
Expand Down Expand Up @@ -63,19 +63,21 @@ class FieldSubmissionQueue {
}
},
update(status) {
this.statusElements.forEach((element) => {
element.classList.remove([
'ongoing',
'success',
'error',
'fail',
]);
element.classList.add(status);
element.dataset.i18n = `fieldsubmission.feedback.${status}`;
element.textContent = t(
`fieldsubmission.feedback.${status}`
);
});
if (options.showStatus) {
this.statusElements.forEach((element) => {
element.classList.remove([
'ongoing',
'success',
'error',
'fail',
]);
element.classList.add(status);
element.dataset.i18n = `fieldsubmission.feedback.${status}`;
element.textContent = t(
`fieldsubmission.feedback.${status}`
);
});
}
},
};

Expand Down

0 comments on commit 7cc3142

Please sign in to comment.