Sha256: 51a163a39aaf2863218717bbf39cf515f85909473be4dec8d8d6d93ca1affee7

Contents?: true

Size: 1.51 KB

Versions: 11

Compression:

Stored size: 1.51 KB

Contents

// Import non minified version, later minifier will make sure minified version
// is provided, while still allowing debugging to use the non minified version.
// import bootstrap from "bootstrap/dist/js/bootstrap.bundle"
import "@popperjs/core"
import "bootstrap"
import * as bootstrap from 'bootstrap'
window.bootstrap = bootstrap

export default class UiBibzInterface {

  constructor(node) {
    this.node = node || document

    // //this.nav()
    this.tooltip()
    // this.dropdown()
    this.popover()
    this.notify()
    this.toast()
  }

  nav(){
    this.node.querySelectorAll('.nav-tabs .nav-item .nav-link').forEach(function(el){
      let tabTrigger = new bootstrap.Tab(el)
      el.addEventListener('click', function (e) {
        e.preventDefault()
        tabTrigger.show()
      })
    })
  }

  popover() {
    this.node.querySelectorAll('[data-bs-toggle="popover"]').forEach(x => new bootstrap.Popover(x))
  }

  tooltip() {
    this.node.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(x => new bootstrap.Tooltip(x))
  }

  dropdown() {
    this.node.querySelectorAll('[data-bs-toggle="dropdown"]').forEach(x => new bootstrap.Dropdown(x))
  }

  toast() {
    this.node.querySelectorAll('.toast').forEach(x => new bootstrap.Toast(x))
  }

  notify() {
    new bootstrap.Alert('.myAlert')
    this.node.querySelectorAll('.alert[data-timeout]').forEach(function(alertElement) {
      setTimeout(function() {
        alertElement.classList.add('fade')
      }, alertElement.getAttribute("data-timeout") )
    })
  }
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta16 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta15 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta14 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta13 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta10 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta9 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta8 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta7 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta6 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta4 app/assets/javascripts/interfaces.js
ui_bibz-4.0.0.beta3 app/assets/javascripts/interfaces.js