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'});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,7 @@ export default class extends Controller {
|
||||
static targets = ['list', 'menu', 'icon'];
|
||||
|
||||
toggleMenu() {
|
||||
/*
|
||||
const target = event.currentTarget;
|
||||
const id = target.getAttribute('data-id');
|
||||
const icon = this.iconTargets.find(i => i.getAttribute('data-id') === id);
|
||||
*/
|
||||
|
||||
this.menuTarget.classList.toggle('is-hidden');
|
||||
//this.toggleIcon(icon);
|
||||
//this.openList(`#${id}-list`);
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
Reference in New Issue
Block a user