Open yenaing-oo opened 3 weeks ago
Would this require that a separate minified JS file be created per page of the form? Not saying that's a bad thing, just wondering.
Yes it would, if there is JS needed for that page. I think if we plan on doing this, it might be a good idea to consider placing the contents of these includes
within the templates themselves, instead of storing them in separate include templates:
{% if DEBUG %}
{% load static %}
<script src="{% static 'recordtransfer/js/profile/profile.js' %}"></script>
{% else %}
{% load pipeline %}
{% javascript 'recordtransfer_profile_js' %}
{% endif %}
The addition of more named JS packages in base.py
would be unavoidable as far as I know.
This may or may not be related, but I'm seeing this error on the Record Description part of the form when I try to open a date picker:
Also JS related, when you click "More" on the rights form set or other identifiers form set, three more forms get added, but only one should be added.
Related to #247. I could see there being multiple "entrypoints" in webpack, one for the overarching JS that the whole site needs, and one for each of the special case pages like the pages of the transfer form
This way, only the relevant JS is loaded for each page, and it will no longer be necessary to avoid running portions of JS where constants are missing, since they are expected to be there.
For e.g. currently, we might have to do something like this in JS to prevent a console error on pages where this constant is not needed:
This means that if the constant
ID_SUBMISSION_GROUP_SELECTION
is not being passed to the JS in a situation where we do need it, it would be hard to detect since no error is raised.