mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-31 13:05:47 +08:00
Modularised/bundled js and made image-manager a proper component
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
|
||||
// Global jQuery Elements
|
||||
$(function () {
|
||||
|
||||
// Notification hiding
|
||||
$('.notification').click(function () {
|
||||
$(this).fadeOut(100);
|
||||
|
||||
});
|
||||
|
||||
// Dropdown toggles
|
||||
@ -18,34 +19,25 @@ $(function () {
|
||||
|
||||
});
|
||||
|
||||
function elemExists(selector) {
|
||||
return document.querySelector(selector) !== null;
|
||||
}
|
||||
|
||||
// Vue JS elements
|
||||
var Vue = require('vue');
|
||||
Vue.use(require('vue-resource'));
|
||||
|
||||
// Vue Components
|
||||
Vue.component('image-manager', require('./components/image-manager.vue'));
|
||||
Vue.component('image-picker', require('./components/image-picker.vue'));
|
||||
|
||||
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';
|
||||
}
|
||||
}
|
||||
});
|
||||
// Vue Controllers
|
||||
if(elemExists('#book-dashboard')) {
|
||||
new Vue(require('./pages/book-show'));
|
||||
}
|
||||
|
||||
// Global Vue Instance
|
||||
// Needs to be loaded after all components we want to use.
|
||||
var app = new Vue({
|
||||
el: '#app'
|
||||
});
|
Reference in New Issue
Block a user