Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/remove temp workaround for pages #5

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions packages/enketo-express/public/js/src/module/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,6 @@ import $ from 'jquery';
import settings from './settings';
import gui from './gui';

// Contains fix for https://github.com/OpenClinica/enketo-express-oc/issues/720
// This function should be removed once PR https://github.com/enketo/enketo/pull/1286 is merged
// and published
pageModule.flipToPageContaining = function ($e) {
const e = $e[0];
const closestPage = e.closest('[role="page"]');

if (closestPage) {
this._flipTo(closestPage);
} else if (e.closest('.question')) {
// If $e is a comment question, and it is not inside a group, there will be no closestPage.
const referer = e.querySelector('[data-for]');
const ancestor = e.closest('.or-repeat, form.or');
if (referer && ancestor) {
const linkedQuestion = ancestor.querySelector(
`[name="${referer.dataset.for}"]`
);
if (linkedQuestion) {
this._flipTo(linkedQuestion.closest('[role="page"]'));
}
}
}
this.$toc.parent().find('.pages-toc__overlay').click();
};

// const originalPageModuleNext = pageModule._next;

// We don't use the original call, because OC only wants to (sometimes) block strict validation (not regular non-strict)
pageModule._next = function () {
const that = this;
Expand Down
Loading