ondemand
ondemand copied to clipboard
refactor _inline_js.html.erb to use the config.js
With #2506 we can move onto refactoring a little in how we pull data from the server into the HTML.
What I'd like to do is stop rendering this as a <script> and start rendering in the ood_config div that we can pull data from.
https://github.com/OSC/ondemand/blob/master/apps/dashboard/app/views/files/_inline_js.html.erb
Here's a more specific example. Instead of this being javascript https://github.com/OSC/ondemand/blob/f230efe132dbc218d2078a1ea272cc7bf7c9b3f1/apps/dashboard/app/views/files/_inline_js.html.erb#L4
We could instead embed it into this html meta tag.
<meta id="ood_config"
<!-- ... -->
data-max-file-fize="<%= Configuration.file_upload_max %>"
/>
Then in the runtime javascript using it would have to pull the value from the config.js.
https://github.com/OSC/ondemand/blob/bd3004adeee6522c58fce799e8825b7801c7e16d/apps/dashboard/app/javascript/packs/files/uppy_ops.js#L70
┆Issue is synchronized with this Asana task by Unito
Then in the runtime javascript using it would have to pull the value from the
config.js.
Is the idea that there is a function in the config.js to call this from uppy_apps.js?
Then in the runtime javascript using it would have to pull the value from the config.js.
Is the idea that there is a function in the config.js to call this from uppy_apps.js?
Yea similar to setNavbarColor or even maybe it exposes all the data and and uppy_apps.js can reference something like configData['maxFileSize'].