Skip to content

Commit

Permalink
refactor: extract jQuery script element as an include template for reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
angela-tran committed Jan 28, 2025
1 parent 69bcdb6 commit c42017b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 4 additions & 0 deletions benefits/enrollment/templates/enrollment/includes/jquery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<script nonce="{{ request.csp_nonce }}"
src="https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.min.js"
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ="
crossorigin="anonymous"></script>
5 changes: 1 addition & 4 deletions benefits/enrollment/templates/enrollment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ <h2 class="h3 pb-1">
{% endcomment %}
{% translate "Please wait..." as loading_text %}

<script nonce="{{ request.csp_nonce }}"
src="https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.min.js"
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ="
crossorigin="anonymous"></script>
{% include "enrollment/includes/jquery.html" %}

<script nonce="{{ request.csp_nonce }}">
var startedEvent = "started card tokenization", closedEvent = "finished card tokenization";
Expand Down
5 changes: 1 addition & 4 deletions benefits/in_person/templates/in_person/enrollment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ <h2 class="p-0 m-0 text-start">In-person enrollment</h2>
<button id="{{ cta_button }}" href="#{{ cta_button }}" class="btn btn-lg btn-primary" role="button">Enroll</button>
</div>

<script nonce="{{ request.csp_nonce }}"
src="https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.min.js"
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ="
crossorigin="anonymous"></script>
{% include "enrollment/includes/jquery.html" %}

<script nonce="{{ request.csp_nonce }}">
var startedEvent = "started card tokenization", closedEvent = "finished card tokenization";
Expand Down

0 comments on commit c42017b

Please sign in to comment.