mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
recipe stuff
This commit is contained in:
18
cookbook/templates/javascript_urls.html
Normal file
18
cookbook/templates/javascript_urls.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!--
|
||||
As there is apparently no good way to pass django named URLs to Vue/Webpack we will pack the urls we need into
|
||||
this object and load it in all the templates where we load Vue apps
|
||||
|
||||
Reason for not using other alternatives
|
||||
|
||||
## django-js-reverse
|
||||
bad performance because the 25kb or so path file needs to be loaded before any other request can be made
|
||||
or all paths need to be printed in template which is apparently not recommended for CSP reasons (although this here
|
||||
might do the same)
|
||||
|
||||
-->
|
||||
|
||||
<script type="application/javascript">
|
||||
window.DJANGO_URLS = {
|
||||
'edit_storage'
|
||||
}
|
||||
</script>
|
||||
@@ -16,8 +16,15 @@
|
||||
{% block script %}
|
||||
<script src="{% url 'javascript-catalog' %}"></script>
|
||||
|
||||
{% if debug %}
|
||||
<script src="{% url 'js_reverse' %}"></script>
|
||||
{% else %}
|
||||
<script src="{% static 'django_js_reverse/js/reverse.js' %}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script type="application/javascript">
|
||||
window.RECIPE_ID = 5;
|
||||
|
||||
</script>
|
||||
|
||||
{% render_bundle 'chunk-vendors' %}
|
||||
|
||||
Reference in New Issue
Block a user