diff --git a/gulpfile.js b/gulpfile.js index 1494c2a5b..7974350d1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,19 +1,8 @@ var elixir = require('laravel-elixir'); -/* - |-------------------------------------------------------------------------- - | Elixir Asset Management - |-------------------------------------------------------------------------- - | - | Elixir provides a clean, fluent API for defining some basic Gulp tasks - | for your Laravel application. By default, we are compiling the Sass - | file for our application, as well as publishing vendor resources. - | - */ elixir(function(mix) { mix.sass('styles.scss'); mix.scripts('image-manager.js', 'public/js/image-manager.js'); - mix.scripts('book-dashboard.js', 'public/js/book-dashboard.js'); - mix.scripts(['jquery-extensions.js', 'global.js'], 'public/js/common.js'); + mix.browserify(['jquery-extensions.js', 'pages/book-show.js' ,'global.js'], 'public/js/common.js'); }); diff --git a/package.json b/package.json index e28a44f23..5106741e3 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,12 @@ "private": true, "devDependencies": { "gulp": "^3.8.8", - "laravel-elixir-livereload": "0.0.3" + "insert-css": "^0.2.0", + "laravel-elixir-livereload": "1.1.3" }, "dependencies": { "bootstrap-sass": "^3.0.0", - "laravel-elixir": "^2.0.0" + "laravel-elixir": "^3.3.1", + "vue": "^0.12.16" } } diff --git a/resources/assets/js/global.js b/resources/assets/js/global.js index a75a4dc74..66326da23 100644 --- a/resources/assets/js/global.js +++ b/resources/assets/js/global.js @@ -16,4 +16,36 @@ $(function () { $(this).closest('.chapter').find('.inset-list').slideToggle(180); }); +}); + + +// Vue Components + +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'; + } + } +}); + +// Global Vue Instance +var app = new Vue({ + el: '#app' }); \ No newline at end of file diff --git a/resources/assets/js/book-dashboard.js b/resources/assets/js/pages/book-show.js similarity index 96% rename from resources/assets/js/book-dashboard.js rename to resources/assets/js/pages/book-show.js index 1315843ab..3d5d35255 100644 --- a/resources/assets/js/book-dashboard.js +++ b/resources/assets/js/pages/book-show.js @@ -1,4 +1,5 @@ -var bookDashboard = new Vue({ + +new Vue({ el: '#book-dashboard', data: { searching: false, diff --git a/resources/assets/js/templates/image-picker.html b/resources/assets/js/templates/image-picker.html new file mode 100644 index 000000000..82f0ef7f3 --- /dev/null +++ b/resources/assets/js/templates/image-picker.html @@ -0,0 +1,10 @@ + +
This image should be 43px in height.
+