Biblio for sites
This commit is contained in:
@@ -5,11 +5,16 @@ export default class extends Controller {
|
||||
|
||||
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.trigger = event.currentTarget;
|
||||
const id = this.trigger.id.replace('cit-', '');
|
||||
this.ref = this.biblioTarget;
|
||||
|
||||
if (this.trigger.parentElement.nodeName === 'TD') {
|
||||
this.ref = this.biblioTargets.find(t => t.id === 'biblio-detail');
|
||||
}
|
||||
|
||||
this.ref.innerHTML = '<button class="delete" data-action="click->biblio#hideBiblio"></button>';
|
||||
this.ref.innerHTML += biblio.getReference(id);
|
||||
|
||||
this.showBiblio();
|
||||
}
|
||||
@@ -19,11 +24,12 @@ export default class extends Controller {
|
||||
}
|
||||
|
||||
showBiblio() {
|
||||
this.biblioTarget.classList.remove('is-hidden');
|
||||
this.biblioTarget.scrollIntoView({behavior: 'smooth'});
|
||||
this.ref.classList.remove('is-hidden');
|
||||
this.ref.scrollIntoView({behavior: 'smooth'});
|
||||
}
|
||||
|
||||
hideBiblio() {
|
||||
this.biblioTarget.classList.add('is-hidden');
|
||||
this.ref.classList.add('is-hidden');
|
||||
this.trigger.parentElement.scrollIntoView({behavior: 'smooth'});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user