Sha256: be1939f11010e67f4855b0f3692ee7953d130812539c667468dfc83f901ad51f
Contents?: true
Size: 953 Bytes
Versions: 6
Compression:
Stored size: 953 Bytes
Contents
import { Controller } from '@hotwired/stimulus' import * as bootstrap from 'bootstrap' export default class extends Controller { static outlets = ['asociable'] static targets = ['response'] modalPuntero = null connect (e) { this.modalPuntero = new bootstrap.Modal(this.element) if (this.element.dataset.removeOnHide) { this.element.addEventListener('hidden.bs.modal', (e) => { this.element.remove() }) } this.modalPuntero.show() document.addEventListener('turbo:before-cache', () => { this.element.remove() }, { once: true }) } responseTargetConnected (e) { const newObject = JSON.parse(e.dataset.response) this.asociableOutlet.completarCampo(newObject) this.element.remove() } openModal () { this.modalPuntero.show() } disconnect (e) { this.modalPuntero.hide() document.dispatchEvent(new Event('hidden.bs.modal')) this.modalPuntero.dispose() } }
Version data entries
6 entries across 6 versions & 1 rubygems