Changeset View
Changeset View
Standalone View
Standalone View
src/resources/js/bootstrap.js
window._ = require('lodash') | |||||
/** | /** | ||||
* We'll load jQuery and the Bootstrap jQuery plugin which provides support | * We'll load jQuery and the Bootstrap jQuery plugin which provides support | ||||
* for JavaScript based Bootstrap features such as modals and tabs. This | * for JavaScript based Bootstrap features such as modals and tabs. This | ||||
* code may be modified to fit the specific needs of your application. | * code may be modified to fit the specific needs of your application. | ||||
*/ | */ | ||||
try { | |||||
window.Popper = require('popper.js').default | window.Popper = require('popper.js').default | ||||
window.$ = window.jQuery = require('jquery') | window.$ = window.jQuery = require('jquery') | ||||
require('bootstrap') | require('bootstrap') | ||||
} catch (e) {} | |||||
/** | /** | ||||
* We'll load Vue, VueRouter and global components | * We'll load Vue, VueRouter and global components | ||||
*/ | */ | ||||
import FontAwesomeIcon from './fontawesome' | import FontAwesomeIcon from './fontawesome' | ||||
import VueRouter from 'vue-router' | import VueRouter from 'vue-router' | ||||
import VueToastr from '@deveodk/vue-toastr' | import Toast from '../vue/Widgets/Toast' | ||||
import store from './store' | import store from './store' | ||||
window.Vue = require('vue') | window.Vue = require('vue') | ||||
Vue.component('svg-icon', FontAwesomeIcon) | Vue.component('svg-icon', FontAwesomeIcon) | ||||
Vue.use(VueToastr, { | |||||
defaultPosition: 'toast-bottom-right', | |||||
defaultTimeout: 5000 | |||||
}) | |||||
const vTooltip = (el, binding) => { | const vTooltip = (el, binding) => { | ||||
const t = [] | const t = [] | ||||
if (binding.modifiers.focus) t.push('focus') | if (binding.modifiers.focus) t.push('focus') | ||||
if (binding.modifiers.hover) t.push('hover') | if (binding.modifiers.hover) t.push('hover') | ||||
if (binding.modifiers.click) t.push('click') | if (binding.modifiers.click) t.push('click') | ||||
if (!t.length) t.push('hover') | if (!t.length) t.push('hover') | ||||
$(el).tooltip({ | $(el).tooltip({ | ||||
title: binding.value, | title: binding.value, | ||||
placement: binding.arg || 'top', | placement: binding.arg || 'top', | ||||
trigger: t.join(' '), | trigger: t.join(' '), | ||||
html: !!binding.modifiers.html, | html: !!binding.modifiers.html, | ||||
}); | }); | ||||
} | } | ||||
Vue.directive('tooltip', { | Vue.directive('tooltip', { | ||||
bind: vTooltip, | bind: vTooltip, | ||||
update: vTooltip, | update: vTooltip, | ||||
unbind (el) { | unbind (el) { | ||||
$(el).tooltip('dispose') | $(el).tooltip('dispose') | ||||
} | } | ||||
}) | }) | ||||
Vue.use(Toast) | |||||
Vue.use(VueRouter) | Vue.use(VueRouter) | ||||
window.router = new VueRouter({ | window.router = new VueRouter({ | ||||
mode: 'history', | mode: 'history', | ||||
routes: window.routes | routes: window.routes | ||||
}) | }) | ||||
Show All 24 Lines |