I’m having a difficult time getting prodigy to allow custom scripts in my recipe specific templates, e.g.
<div class="button">Custom Stuff</div>
<script>
alert("Yay!");
</script>
There’s a react github discussion about it, but the TLDR is it looks like ele.innerHTML = '<script>...</script>';
doesn’t work.
I saw a suggestion that maybe static/index.html
could be modified to include a script, but I don’t think that’s a very workable solution (unless I misunderstand) because you’d have to copy the files into or out of site-packages
.
Perhaps a new recipe option to specify a single script file that will be injected into the base page, when combined with an html_template
, e.g.
with open('recipes/textcat_eval.html') as txt:
template_text = txt.read()
with open('recipes/textcat_eval.js') as txt:
script_text = txt.read()
@recipe('textcat.eval',...)
def evaluate(...):
...
return {
'view_id': 'html',
'config': {
'html_template': template_text,
'html_script': script_text,
}
}
I’m interested in generating more than one example from a single example being reviewed, so I would like to add new interactions that let the user give slightly more feedback before a yes/no. This should allow me to generate multiple examples for the DB when they do finally accept/reject the example.
I can’t really approach this kind of problem without being able to include scripts. I’m not blocked on this now, but I want to bring it up for a discussion because I think allowing scripting will lead to much more interesting custom templates.