Sha256: 42f8dbefb731b8851ac4fe2f18a3a62a84b433b0a47e45a2e7b8cf7df28246d1

Contents?: true

Size: 840 Bytes

Versions: 12

Compression:

Stored size: 840 Bytes

Contents

import { Controller } from '@hotwired/stimulus'
import * as bootstrap from 'bootstrap'

export default class extends Controller {
  popover = null

  connect () {
    const container = this.element.closest('.modal-body') ? '.modal-body' : 'body'
    this.popover = new bootstrap.Popover(this.element, {
      // WARNING: don't use for user input html
      sanitize: false,
      container,
      template: `
<div class="popover" role="tooltip" data-controller="popover">
  <div class="popover-arrow"></div>
  <div class="popover-header"></div>
  <button type="button" class="btn-close position-absolute" data-action="popover#close" style="top: 1em; right: 1em;" aria-label="Close"></button>
  <div class="popover-body">
  </div>
</div>
      `
    })
  }

  disconnect () {
    if (this.popover) {
      this.popover.dispose()
    }
  }
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pg_rails-7.5.1 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.5.0 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.4.3 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.4.2 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.4.1 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.4.0 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.3.5 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.3.4 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.3.3 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.3.2 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.3.1 pg_layout/app/javascript/controllers/popover_toggler_controller.js
pg_rails-7.3.0 pg_layout/app/javascript/controllers/popover_toggler_controller.js