Sha256: 0c18a4c4f98e06e5405f1a593848c4d73908b91e4f9a26384f01822acec428e9

Contents?: true

Size: 730 Bytes

Versions: 4

Compression:

Stored size: 730 Bytes

Contents

import ApplicationController from './application_controller'

import Modal from '../core/modal'

export default class extends ApplicationController {
  connect () {
    this.modal = new Modal(this.element)
    this.modal.show()

    this.element.addEventListener('hidden.bs.modal', () => this.remove())
  }

  disconnect () {
    this.modal.dispose()
  }

  remove () {
    this.element.remove()
  }

  hide () {
    this.modal.hide()
  }

  submit (detail) {
    let event = this.dispatch('submit', { detail: detail })
    if (event.defaultPrevented) return

    if (this.modalTrigger) {
      event = this.modalTrigger.dispatch('submit', { detail: detail })
      if (event.defaultPrevented) return
    }

    this.hide()
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trestle-0.10.1 frontend/js/controllers/modal_controller.js
trestle-0.10.0 frontend/js/controllers/modal_controller.js
trestle-0.10.0.pre2 frontend/js/controllers/modal_controller.js
trestle-0.10.0.pre frontend/js/controllers/modal_controller.js