Show annotations on overview of favorites
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
Reference in New Issue
Block a user