Sha256: 38c0aac1a9c56c033746cf9e4b7140472ba116c502599dbc327c455126d84248

Contents?: true

Size: 680 Bytes

Versions: 5

Compression:

Stored size: 680 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)
    this.modalPuntero.show()
  }

  responseTargetConnected (e) {
    const newObject = JSON.parse(e.dataset.response)
    this.asociableOutlet.completarCampo(newObject)
    this.element.remove()
  }

  openModal () {
    this.modalPuntero.show()
  }

  disconnect (e) {
    this.modalPuntero.dispose()
    document.querySelectorAll('.modal-backdrop').forEach(e => { e.remove() })
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pg_rails-7.0.8.pre.alpha.10 pg_associable/app/javascript/modal_controller.js
pg_rails-7.0.8.pre.alpha.9 pg_associable/app/javascript/modal_controller.js
pg_rails-7.0.8.pre.alpha.8 pg_associable/app/javascript/modal_controller.js
pg_rails-7.0.8.pre.alpha.7 pg_associable/app/javascript/modal_controller.js
pg_rails-7.0.8.pre.alpha.6 pg_associable/app/javascript/modal_controller.js