Biblio controller + update findings

This commit is contained in:
2024-11-27 17:01:08 +01:00
parent 7f4bd571f0
commit 895ff4af1e
12 changed files with 83 additions and 83 deletions

View File

@@ -0,0 +1,29 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ['biblio', 'cit', 'ref', 'close'];
open(event) {
const biblio = window.Biblio;
const target = event.currentTarget;
const id = target.id.replace('cit-', '');
this.biblioTarget.innerHTML = '<button class="delete" data-action="click->biblio#hideBiblio"></button>';
this.biblioTarget.innerHTML += biblio.getReference(id);
this.showBiblio();
}
close() {
this.modalTarget.classList.remove('is-active');
}
showBiblio() {
this.biblioTarget.classList.remove('is-hidden');
this.biblioTarget.scrollIntoView({behavior: 'smooth'});
}
hideBiblio() {
this.biblioTarget.classList.add('is-hidden');
}
}