Summary
Currently the reaction-box widgets can only be placed in Jinja templates. To allow use in Django html templates and even in a Wagtail html block, we can reference the script in data-init.js and init.js the same way the feedback.js is referenced.
In addition to expanding the locations the widget can be added , it will also make adding/removing much simpler because now to implement a reactrion-box on a page, all one has to do is add the macro or html code to a page .It will be detected and the JS takes care of itself.
Exporting ReactionBox as a module will allow us to write tests for it as well
Current Situation
Currently the reaction-box widgets can only be placed in Jinja templates and requires adding a reference to the JS file on that page as well.
Use Case
UX or Content team want a reaction box on a non-Jinja template, or on a specific Wagtail page
Misc
This has been tested locally and seems to work as expected
If it has not been deleted yet, there is a WIP branch test/reaction-box
Tech steps:
Summary
Currently the reaction-box widgets can only be placed in Jinja templates. To allow use in Django html templates and even in a Wagtail html block, we can reference the script in
data-init.jsandinit.jsthe same way the feedback.js is referenced.In addition to expanding the locations the widget can be added , it will also make adding/removing much simpler because now to implement a reactrion-box on a page, all one has to do is add the macro or html code to a page .It will be detected and the JS takes care of itself.
Exporting ReactionBox as a module will allow us to write tests for it as well
Current Situation
Currently the reaction-box widgets can only be placed in Jinja templates and requires adding a reference to the JS file on that page as well.
Use Case
UX or Content team want a reaction box on a non-Jinja template, or on a specific Wagtail page
Misc
This has been tested locally and seems to work as expected
If it has not been deleted yet, there is a WIP branch
test/reaction-boxTech steps:
reaction-box.jstodata-init.jsandinit.jsreaction-box.jsfrom /pages to /modules and export it as a modulemodule.exports = { ReactionBox: ReactionBox };reaction-boxmodule indata-init.jsandinit.jsthe same way the feedback.js is required