53 lines
1.3 KiB
JavaScript
Vendored
53 lines
1.3 KiB
JavaScript
Vendored
require('./bootstrap');
|
|
require('./session_watch');
|
|
//window.Vue = require('vue/dist/vue.min.js');
|
|
import Vue from 'vue'
|
|
import moment from 'moment'
|
|
import 'moment/locale/fr'
|
|
import vSelect from 'vue-select'
|
|
|
|
moment.locale('fr')
|
|
|
|
// v-select
|
|
Vue.component('v-select', vSelect)
|
|
|
|
Vue.prototype.moment = moment
|
|
Vue.prototype.bootstrap = bootstrap
|
|
|
|
// Register modules
|
|
const modules = require.context("./modules", true, /\.js$/i);
|
|
modules.keys().map(key => Vue.mixin(modules(key).default));
|
|
|
|
// Register components
|
|
const vues = require.context("./components", true, /\.vue$/i);
|
|
vues.keys().map(key =>
|
|
Vue.component(
|
|
key
|
|
.split("/")
|
|
.pop()
|
|
.split(".")[0]
|
|
.replace(/\.?([A-Z])/g, function (x, y) {
|
|
return "-" + y.toLowerCase();
|
|
})
|
|
.replace(/^-/, ""),
|
|
vues(key).default
|
|
)
|
|
);
|
|
|
|
// Register vue function
|
|
Vue.filter('str_limit', function (value, size) {
|
|
if (!value) return '';
|
|
value = value.toString();
|
|
if (value.length <= size) {
|
|
return value;
|
|
}
|
|
return value.substr(0, size) + '...';
|
|
});
|
|
Vue.filter('ucfirst', function (value) {
|
|
return value.charAt(0).toUpperCase() + value.slice(1)
|
|
});
|
|
|
|
for (let el of document.getElementsByClassName('vueComponent')) {
|
|
new Vue({ el: el });
|
|
}
|
|
|