Sha256: 9a2e0acf33f0f7b8853d14b286ac3ee5a38d0c2ac12bed85a3d2e1c68d925a7d

Contents?: true

Size: 399 Bytes

Versions: 8

Compression:

Stored size: 399 Bytes

Contents

import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
  static targets = ['modal', 'backdrop']

  static values = {
    closeModalOnBackdropClick: true,
  }

  close() {
    if (event.target === this.backdropTarget && !this.closeModalOnBackdropClickValue) return

    this.modalTarget.remove()

    document.dispatchEvent(new Event('actions-modal:close'))
  }
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
avo-3.15.1 app/javascript/js/controllers/modal_controller.js
avo-3.15.0 app/javascript/js/controllers/modal_controller.js
avo-3.14.5 app/javascript/js/controllers/modal_controller.js
avo-3.14.4 app/javascript/js/controllers/modal_controller.js
avo-3.14.3 app/javascript/js/controllers/modal_controller.js
avo-3.14.2 app/javascript/js/controllers/modal_controller.js
avo-3.14.1 app/javascript/js/controllers/modal_controller.js
avo-3.14.0 app/javascript/js/controllers/modal_controller.js