-Vue.component('image-picker', {
- template: require('./templates/image-picker.html'),
- props: ['currentImage', 'name', 'imageClass'],
- data: function() {
- return {
- image: this.currentImage
- }
- },
- methods: {
- showImageManager: function(e) {
- var _this = this;
- ImageManager.show(function(image) {
- _this.image = image.url;
- });
- },
- reset: function() {
- this.image = '';
- },
- remove: function() {
- this.image = 'none';
- }
- }
+// AngularJS - Create application and load components
+const angular = require("angular");
+require("angular-resource");
+require("angular-animate");
+require("angular-sanitize");
+require("angular-ui-sortable");
+
+let ngApp = angular.module('bookStack', ['ngResource', 'ngAnimate', 'ngSanitize', 'ui.sortable']);
+
+// Translation setup
+// Creates a global function with name 'trans' to be used in the same way as Laravel's translation system
+const Translations = require("./translations");
+let translator = new Translations(window.translations);
+window.trans = translator.get.bind(translator);
+
+
+require("./vues/vues");
+require("./components");
+
+// Load in angular specific items
+const Directives = require('./directives');
+const Controllers = require('./controllers');
+Directives(ngApp, window.$events);
+Controllers(ngApp, window.$events);
+
+//Global jQuery Config & Extensions
+
+// Smooth scrolling
+jQuery.fn.smoothScrollTo = function () {
+ if (this.length === 0) return;
+ $('html, body').animate({
+ scrollTop: this.offset().top - 60 // Adjust to change final scroll position top margin
+ }, 300); // Adjust to change animations speed (ms)
+ return this;
+};
+
+// Making contains text expression not worry about casing
+jQuery.expr[":"].contains = $.expr.createPseudo(function (arg) {
+ return function (elem) {
+ return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
+ };