From 270dcf4e2b20a336c0d478460dda3e9654420437 Mon Sep 17 00:00:00 2001 From: Splines Date: Sun, 4 Aug 2024 17:11:29 +0200 Subject: [PATCH] Get rid of turbolinks:load and apply directly This is to avoid caching issues. --- app/assets/javascripts/annotations_overview.js | 6 ++++-- app/views/annotations/annotations_overview.html.erb | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/annotations_overview.js b/app/assets/javascripts/annotations_overview.js index c526e2bf6..6d46a7617 100644 --- a/app/assets/javascripts/annotations_overview.js +++ b/app/assets/javascripts/annotations_overview.js @@ -1,4 +1,4 @@ -$(document).on("turbolinks:load", function () { +function colorAnnotationCardsSharedByStudents() { const annotationCards = $("[data-annotation-card-category]"); for (let card of annotationCards) { const category = card.dataset.annotationCardCategory; @@ -8,4 +8,6 @@ $(document).on("turbolinks:load", function () { const color = Category.getByName(category).color; card.style.borderColor = color; } -}); +} + +colorAnnotationCardsSharedByStudents(); diff --git a/app/views/annotations/annotations_overview.html.erb b/app/views/annotations/annotations_overview.html.erb index 8ad793bf7..dbb6d40d6 100644 --- a/app/views/annotations/annotations_overview.html.erb +++ b/app/views/annotations/annotations_overview.html.erb @@ -1,5 +1,4 @@ <%= stylesheet_link_tag 'annotations_overview' %> -<%= javascript_include_tag :annotations_overview %>
@@ -64,3 +63,5 @@
+ +<%= javascript_include_tag :annotations_overview %>