Show annotations on overview of favorites

This commit is contained in:
2020-06-10 15:05:41 +02:00
parent ba2e90386f
commit a0480036bf
12 changed files with 186 additions and 17 deletions
+2
View File
@@ -3,6 +3,8 @@
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
require("packs/custom")
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
+21
View File
@@ -0,0 +1,21 @@
function toggleAnnotations() {
var annotationCells = document.querySelectorAll("#annotation");
if (document.getElementById("toggleAnnotations").checked === true) {
annotationCells.forEach(setVisible);
} else {
annotationCells.forEach(setInvisible);
}
}
function setVisible(item) {
item.style.display = "block";
}
function setInvisible(item) {
item.style.display = "none";
}
/* First load all other scripts and then listen for click on checkbox */
document.addEventListener('turbolinks:load', () => {
document.getElementById("toggleAnnotations").addEventListener("click", toggleAnnotations);
});