Split the rendering of JavaScript action models and views.
Review Request #14665 — Created Oct. 31, 2025 and updated
We now have enough support for multiple views for the same action. It's
time to separate out the registration of the models and the views so
there's no longer a one-to-one association.The new
BaseAction.render_model_js()is responsible for writing the
JavaScript to render an action model. Every registered action in Python
will be registered in JavaScript.The existing
BaseAction.render_js()(old name currently kept for
compatibility reasons) will render the view. This is now only called
when the attachment points used on the page, rather than all attachment
points. That's handled in the{% actions_html %}template tag.The template tag renders the HTML for the attachment point where the
template tag is placed, and then sets up a page injection containing the
JavaScript views. Then, when rendering the JavaScript models, the
injected JavaScript views content will be included.Some of the design of this change is here to facilitate the upcoming
improvements to attachment points.
Unit tests pass.
Tested that all the actions on the page displayed and worked correctly.
| Summary | ID |
|---|---|
| ac05257d3e82428a725f410c1bcd8cc5f9766b95 |
| Description | From | Last Updated |
|---|---|---|
|
Expected a string and instead saw %. Column: 2 Error code: W095 |
|
|
|
Expected ':' and instead saw 'load'. Column: 4 Error code: E021 |
|
|
|
Expected a JSON value. Column: 9 Error code: E003 |
|
|
|
Expected '}' and instead saw 'actions'. Column: 9 Error code: E021 |
|
|
|
Unrecoverable syntax error. (11% scanned). Column: 9 Error code: E041 |
|