Skip to content

Commit

Permalink
Do not load Google resources and related JS on confirmation page
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkuhhaut committed Jul 9, 2021
1 parent 865cd52 commit c0b3883
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions gsheets_import/templates/admin/gsheets_import/import.html
Expand Up @@ -226,18 +226,20 @@ <h2>{% trans "Preview" %}</h2>

{{ block.super }}

{# Load JavaScript's Google API and a custom script to handle the import of Google Sheets #}
<script>
const developerKey = '{{ gsheets_import_api_key }}';
const clientId = '{{ gsheets_import_client_id }}';
const appId = '{{ gsheets_import_app_id }}';
const gsFormatDisplayName = '{{ gs_format_display_name }}';
const dummyChoiceTxt = '{{ dummy_choice_txt }}';
</script>
<script type="text/javascript" src="{% static 'gsheets_import/js/import_gs.js' %}"></script>
<script async defer src="https://apis.google.com/js/api.js"
onload="this.onload = function() {}; loadLibraries()"
onreadystatechange="if(this.readyState === 'complete') this.onload()">
</script>
{% if not confirm_form %}
{# Load JavaScript's Google API and a custom script to handle the import of Google Sheets #}
<script>
const developerKey = '{{ gsheets_import_api_key }}';
const clientId = '{{ gsheets_import_client_id }}';
const appId = '{{ gsheets_import_app_id }}';
const gsFormatDisplayName = '{{ gs_format_display_name }}';
const dummyChoiceTxt = '{{ dummy_choice_txt }}';
</script>
<script type="text/javascript" src="{% static 'gsheets_import/js/import_gs.js' %}"></script>
<script async defer src="https://apis.google.com/js/api.js"
onload="this.onload = function() {}; loadLibraries()"
onreadystatechange="if(this.readyState === 'complete') this.onload()">
</script>
{% endif %}

{% endblock %}

0 comments on commit c0b3883

Please sign in to comment.