summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/directives/tooltip.js
blob: 02ac0aedf4fe8ee5dfbabd3c213aa578383c44e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import $ from 'jquery';

export default {
  bind(el) {
    const tooltipOptions = {};

    if (typeof el.dataset.html !== 'undefined') {
      tooltipOptions.html = true;
    }

    $(el).tooltip(tooltipOptions);
  },

  componentUpdated(el) {
    $(el).tooltip('fixTitle');
  },

  unbind(el) {
    $(el).tooltip('destroy');
  },
};