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

/**
 * Helper to user bootstrap popover in vue.js.
 * Follow docs for html attributes: https://getbootstrap.com/docs/3.3/javascript/#static-popover
 *
 * @example
 * import popover from 'vue_shared/directives/popover.js';
 * {
 *   directives: [popover]
 * }
 * <a v-popover="{options}">popover</a>
 */
export default {
  bind(el, binding) {
    $(el).popover(binding.value);
  },

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