mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-13 00:26:31 +00:00
Migrated from Sprockets to Propshaft.
This commit is contained in:
@@ -5,9 +5,8 @@
|
||||
<%= csrf_meta_tags %>
|
||||
<%= action_cable_meta_tag %>
|
||||
<title>WrestlingDev</title>
|
||||
<%= stylesheet_link_tag "application", media: "all",
|
||||
"data-turbolinks-track" => true %>
|
||||
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
||||
<%= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload" %>
|
||||
<%= javascript_importmap_tags %>
|
||||
<%= render 'layouts/cdn' %>
|
||||
<%= render 'layouts/shim' %>
|
||||
</head>
|
||||
@@ -22,8 +21,8 @@
|
||||
<% if Rails.env.production? %>
|
||||
<%= render 'layouts/analytics' %>
|
||||
<% end %>
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload" %>
|
||||
<%= javascript_importmap_tags %>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= render 'layouts/cdn' %>
|
||||
<%= render 'layouts/shim' %>
|
||||
|
||||
@@ -384,7 +384,7 @@ function initializeFromLocalStorage() {
|
||||
}
|
||||
|
||||
// ############### ACTION CABLE LIFECYCLE (Define Before Listeners) #############
|
||||
var matchSubscription = null; // Use var for safety with Turbolinks re-evaluation
|
||||
var matchSubscription = null; // Use var for safety with Turbo re-evaluation / page navigation
|
||||
|
||||
function cleanupSubscription() {
|
||||
if (matchSubscription) {
|
||||
@@ -484,8 +484,8 @@ function setupSubscription(matchId) {
|
||||
|
||||
// ############### EVENT LISTENERS (Define Last) #############
|
||||
|
||||
document.addEventListener("turbolinks:load", () => {
|
||||
console.log("Stats Event: turbolinks:load fired.");
|
||||
document.addEventListener("turbo:load", () => {
|
||||
console.log("Stats Event: turbo:load fired.");
|
||||
|
||||
// --- Check if we are actually on the match stats page ---
|
||||
const statsElementCheck = document.getElementById('match_w1_stat'); // Check for stats textarea
|
||||
@@ -507,12 +507,12 @@ document.addEventListener("turbolinks:load", () => {
|
||||
if (matchId) {
|
||||
setupSubscription(matchId);
|
||||
} else {
|
||||
console.warn("Stats Event: turbolinks:load - Could not determine match ID for AC setup.");
|
||||
console.warn("Stats Event: turbo:load - Could not determine match ID for AC setup.");
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("turbolinks:before-cache", () => {
|
||||
console.log("Event: turbolinks:before-cache fired. Cleaning up subscription.");
|
||||
document.addEventListener("turbo:before-cache", () => {
|
||||
console.log("Event: turbo:before-cache fired. Cleaning up subscription.");
|
||||
cleanupSubscription();
|
||||
});
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ function createTextInput(id, placeholder, label) {
|
||||
return container;
|
||||
}
|
||||
|
||||
// Initialize on both DOMContentLoaded and turbolinks:load
|
||||
// Initialize on both DOMContentLoaded and turbo:load
|
||||
document.addEventListener("DOMContentLoaded", initializeScoreFields);
|
||||
document.addEventListener("turbolinks:load", initializeScoreFields);
|
||||
document.addEventListener("turbo:load", initializeScoreFields);
|
||||
</script>
|
||||
|
||||
@@ -78,8 +78,8 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// ############### ACTION CABLE LIFECYCLE & SETUP #############
|
||||
var matchSubscription = null; // Use var for Turbolinks compatibility
|
||||
// ############### ACTION CABLE LIFECYCLE #############
|
||||
var matchSubscription = null; // Use var for handling Turbo page navigations
|
||||
|
||||
// Function to tear down the existing subscription
|
||||
function cleanupSubscription() {
|
||||
@@ -188,12 +188,12 @@ function setupSubscription(matchId) {
|
||||
);
|
||||
}
|
||||
|
||||
// ############### EVENT LISTENERS (Define Last) #############
|
||||
// ############### EVENT LISTENERS #############
|
||||
|
||||
document.addEventListener("turbolinks:load", () => {
|
||||
console.log("Spectator Event: turbolinks:load fired.");
|
||||
|
||||
// --- Check if we are actually on the spectator page ---
|
||||
document.addEventListener("turbo:load", () => {
|
||||
console.log("Spectator Event: turbo:load fired.");
|
||||
|
||||
// Check for necessary elements before proceeding
|
||||
const spectatorElementCheck = document.getElementById('w1-stats-display');
|
||||
if (!spectatorElementCheck) {
|
||||
console.log("Spectator Event: Not on spectator page, skipping AC setup.");
|
||||
@@ -201,18 +201,17 @@ document.addEventListener("turbolinks:load", () => {
|
||||
cleanupSubscription();
|
||||
return;
|
||||
}
|
||||
// --- End Check ---
|
||||
|
||||
|
||||
const matchId = <%= @match.id %>; // Get match ID from ERB
|
||||
if (matchId) {
|
||||
setupSubscription(matchId);
|
||||
} else {
|
||||
console.warn("Spectator Event: turbolinks:load - Could not determine match ID");
|
||||
console.warn("Spectator Event: turbo:load - Could not determine match ID");
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("turbolinks:before-cache", () => {
|
||||
console.log("Spectator Event: turbolinks:before-cache fired. Cleaning up subscription.");
|
||||
document.addEventListener("turbo:before-cache", () => {
|
||||
console.log("Spectator Event: turbo:before-cache fired. Cleaning up subscription.");
|
||||
cleanupSubscription();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user