Sha256: ba4dd40156ea43b555ccbf74526e57b1507f45e36592b95a99c37065ab526d7d

Contents?: true

Size: 657 Bytes

Versions: 4

Compression:

Stored size: 657 Bytes

Contents

import ApplicationController from './application_controller'

import { Tooltip } from 'bootstrap'

const TEMPLATE = `
<div class="tooltip nav-tooltip" role="tooltip">
  <div class="tooltip-arrow"></div>
  <div class="tooltip-inner"></div>
</div>
`

export default class extends ApplicationController {
  static targets = ["label"]

  connect () {
    this.tooltip = new Tooltip(this.element, {
      trigger: 'hover',
      placement: 'right',
      boundary: 'window',
      template: TEMPLATE,
      title: () => this.labelText
    })
  }

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

  get labelText () {
    return this.labelTarget.innerText
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

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