Closed jgonggrijp closed 1 month ago
I must admit that it took me some time to understand how this works.
No shame in that, especially given that it was already expected.
Part of that was because it is hard to find out what kind of values are expected in the various properties of the
navigationState
model. Is there a usual way to document what the model's properties mean?
Not that I'm aware of, but we can probably agree on something. Do you have suggestions?
I think also
collection.search.view.js
has to be renamed tocatalog.search.view.js
, but maybe it is better to do that after #183 is merged.
Agreed!
@jgonggrijp : I have merged develop into your branch so that I can continue with the next step. The merge conflicts were not dramatic and it helped me to understand your new set-up better.
@tijmenbaarda I will rebase this branch on develop
before merging, because the history will be cleaner in that way. However, it is no problem if you already based new work on this branch; you can rebase your new branch on develop
again afterwards.
This branch closes #177 and also partially addresses #123, #130 and #131.
These changes demonstrate a few tricks and principles (apart from a few other, minor cleanups):
active
class in response tofocus
/blur
events from its.model
(i.e., the catalog or collection in question). This avoids having to redraw both dropdown menus entirely every time the selection changes.enter
andexit
events on a state model, to insert a new view into the DOM and also cleanly remove it again when appropriate. This is also used to trigger thefocus
/blur
events on the catalogs and collections.route
events from a router, rather than defining route-handling methods directly within the router itself.GlobalVariables
. The main.js creates instances of these classes and adds coupling from the outside, mostly by binding methods of one instance to events of another.I write "demonstrate", because there is also still some code that could use the above treatment, but which I skipped. That means that #123, #130 and #131 cannot be closed yet.
You are cordially invited to read the code changes for inspiration. I expect at least some of the changes to raise questions; please do not hesitate to ask for clarification where needed.
I expect these changes to conflict with changes that you have written in parallel. I propose to merge your changes first, I will rebase my changes on yours after that.