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

Commit

Permalink
fixed: loading to the wrong page if the first page contains no dn wid…
Browse files Browse the repository at this point in the history
…get, kobotoolbox#720

emporary duplicate fix that can be reverted later,
  • Loading branch information
MartijnR committed Nov 30, 2023
1 parent bf5e723 commit 90807b3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions public/js/src/module/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@ import reasons from './reasons';
import settings from './settings';
import gui from './gui';


Check failure on line 9 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (16)

Delete `⏎`

Check failure on line 9 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Delete `⏎`

Check failure on line 9 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Delete `⏎`
// 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) {

Check failure on line 13 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (16)

Replace `pageModule.flipToPageContaining·=·function` with `(pageModule.flipToPageContaining·=·function·`

Check failure on line 13 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Replace `pageModule.flipToPageContaining·=·function` with `(pageModule.flipToPageContaining·=·function·`

Check failure on line 13 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Replace `pageModule.flipToPageContaining·=·function` with `(pageModule.flipToPageContaining·=·function·`
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();
},

Check failure on line 33 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (16)

Insert `)`

Check failure on line 33 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (16)

Unexpected use of comma operator

Check failure on line 33 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Insert `)`

Check failure on line 33 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Unexpected use of comma operator

Check failure on line 33 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Insert `)`

Check failure on line 33 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Unexpected use of comma operator

Check failure on line 34 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (16)

Replace `⏎⏎⏎` with `····`

Check failure on line 34 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Replace `⏎⏎⏎` with `····`

Check failure on line 34 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Replace `⏎⏎⏎` with `····`


/*
* The only thing we want to change in this function for OC,

Check failure on line 38 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (16)

Insert `····`

Check failure on line 38 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Insert `····`

Check failure on line 38 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Insert `····`
* is to NOT flip to the next page when a repeat is the same as a page and

Check failure on line 39 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (16)

Insert `····`

Check failure on line 39 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Insert `····`

Check failure on line 39 in public/js/src/module/page.js

View workflow job for this annotation

GitHub Actions / build (14)

Insert `····`
Expand Down

0 comments on commit 90807b3

Please sign in to comment.