Sha256: f718cbb64883a9b71a77e816cea07d5774610d218325e6d573d43e03e1d384f8

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

import { Controller } from "@hotwired/stimulus"
import { useClickOutside } from 'stimulus-use'

// simple controller to hide/show the filter modal
export default class extends Controller {
  static targets = ["frame"]

  static values = {
    src: String,
    isOpen: {type: Boolean, default: false}
  }

  connect() {
    useClickOutside(this)
  }

  disconnect() {
  }

  open(event) {
    console.log("Opening modal!!!", this.srcValue)
    event.preventDefault()
    this.frameTarget.src = this.srcValue;
    this.isOpenValue = true
  }

  close(event) {
    if (this.isOpenValue) {
      event?.preventDefault()
      this.frameTarget.innerHTML = "";
      this.isOpenValue = false
    }
  }

  clickOutside(event) {
    this.close(event)
  }


}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refine-rails-2.11.11 app/javascript/controllers/refine/modal-controller.js
refine-rails-2.11.10 app/javascript/controllers/refine/modal-controller.js
refine-rails-2.11.9 app/javascript/controllers/refine/modal-controller.js