Skip to content

Commit

Permalink
move turbolinks nonce header js out of application.js
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanEddyIC committed Jan 6, 2025
1 parent 865d69b commit 85182ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
9 changes: 7 additions & 2 deletions app/assets/javascripts/inline_replacements.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
document.addEventListener("turbolinks:request-start", function(event) {
var xhr = event.data.xhr;
xhr.setRequestHeader("X-Turbolinks-Nonce", $("meta[name='csp-nonce']").prop('content'));
});

$(document).on('click', ".remove-child-row-btn", function() {
$('tr.child-row:visible').remove();
});
Expand Down Expand Up @@ -50,7 +55,7 @@ $(document).on('click', '#priorSepModal .btn-confirmation', function() {

$(document).on('click', '.broker-staff-registration-container span.search', function() {
// components/benefit_sponsors/app/views/benefit_sponsors/profiles/broker_agencies/broker_agency_staff_roles/_new_staff_applicant.html.erb
brokerSearch();
brokerSearch();
return false
});

Expand Down Expand Up @@ -352,4 +357,4 @@ function selectBrokereAgency(element) {
element.dataset.broker_agency_profile_id;
element.closest('.staff-select-broker').classList.add('agency-selected');
document.getElementById('broker-staff-btn').disabled = false;
}
}
4 changes: 0 additions & 4 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import 'channels';

Rails.start()
Turbolinks.start()
document.addEventListener("turbolinks:request-start", function(event) {
var xhr = event.data.xhr;
xhr.setRequestHeader("X-Turbolinks-Nonce", $("meta[name='csp-nonce']").prop('content'));
});

const importAll = (r) => r.keys().map(r)
importAll(require.context('../images', false, /\.(png|jpe?g|svg|ico)$/));
Expand Down
4 changes: 0 additions & 4 deletions app/javascript/packs/no_jquery_application.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import 'sweetalert2';
import 'channels';

Turbolinks.start()
document.addEventListener("turbolinks:request-start", function(event) {
var xhr = event.data.xhr;
xhr.setRequestHeader("X-Turbolinks-Nonce", $("meta[name='csp-nonce']").prop('content'));
});

const importAll = (r) => r.keys().map(r)
importAll(require.context('../images', false, /\.(png|jpe?g|svg|ico)$/));
Expand Down

0 comments on commit 85182ec

Please sign in to comment.