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

Correctly order the dashboard and diary tabs when they are present. #941

Conversation

shankari
Copy link
Contributor

Original change: 334c024
Next fix: e8c6c5c

This should work, but I think I also need to go to bed now
After conditional inclusion.

As part of the fix(es) for e-mission/e-mission-docs#875 (comment)
11954, we turned off the diary screen and the dashboard screen if they didn't make sense for the
current configuration. This was not super well tested, so we needed a couple of backup fixes (334c024, e8c6c5c), but it finally got done in 8a05333

However, in the (common) case where all the screens were labeled, because the
conditionals for the screens were evaluated only after the dynamic config was
done, they were tacked on at the end, so the order looked weird.

This was surprisingly hard to fix, some options that didn't work were:
- putting an ng-if scope variable across the entire main.html to delay the
  initialization of the tabs
- using `hidden` and `disable` tags

So finally, I decided to use jquery to access the HTML elements directly and move them around.
Note that these HTML elements are not the `ion-tab` elemeents, although they do have a 1:1 mapping.
It turns out that at the end of the `DynamicConfig` callback, only two tabs have been added.
However, in the `afterEnter` callback, we can see all 4 tabs!!
So we move the diary and dashboard (if they exist) to before and after the label screen.

Testing done:
- MULTILABEL (`stage-study`): all tabs appear in the correct order
- ENEKETO (`study-program`): only label and profile tabs appear
@shankari shankari merged commit b9a9391 into e-mission:survey_refactor_expansion Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant