2015-10-09 00:49:18 +02:00
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="image-picker">
|
|
|
|
<div>
|
2015-11-01 21:00:57 +01:00
|
|
|
<img v-if="image && image !== 'none'" :src="image" :class="imageClass" alt="Image Preview">
|
2015-10-09 00:49:18 +02:00
|
|
|
</div>
|
2015-11-01 21:00:57 +01:00
|
|
|
<button class="button" type="button" v-on:click="showImageManager">Select Image</button>
|
2015-10-09 00:49:18 +02:00
|
|
|
<br>
|
2015-11-01 21:00:57 +01:00
|
|
|
<button class="text-button" v-on:click="reset" type="button">Reset</button> <span class="sep">|</span> <button class="text-button neg" v-on:click="remove" type="button">Remove</button>
|
|
|
|
<input type="hidden" :name="name" :id="name" v-model="image">
|
2015-10-09 00:49:18 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
module.exports = {
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
}
|
2015-11-01 21:00:57 +01:00
|
|
|
};
|
2015-10-09 00:49:18 +02:00
|
|
|
</script>
|