aboutsummaryrefslogtreecommitdiff
path: root/src/components/image_cropper/image_cropper.vue
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-02-19 15:37:01 +0000
committerShpuld Shpludson <shp@cock.li>2019-02-19 15:37:01 +0000
commit7b9a6f8d43e6810957f37923ace0d83b8ae44f59 (patch)
tree2eba1b6f6037e1cc02d11df79ab436e70280a093 /src/components/image_cropper/image_cropper.vue
parent8f96de2ba5b87f71bc4a669090b16ec4156461fe (diff)
parent3094c50ff9e7abc7fc8b7fa4d21d606170843178 (diff)
Merge branch '256-avatar-crop-popup' into 'develop'
Add avatar cropper Closes #256 See merge request pleroma/pleroma-fe!547
Diffstat (limited to 'src/components/image_cropper/image_cropper.vue')
-rw-r--r--src/components/image_cropper/image_cropper.vue42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/components/image_cropper/image_cropper.vue b/src/components/image_cropper/image_cropper.vue
new file mode 100644
index 00000000..24a6f3bd
--- /dev/null
+++ b/src/components/image_cropper/image_cropper.vue
@@ -0,0 +1,42 @@
+<template>
+ <div class="image-cropper">
+ <div v-if="dataUrl">
+ <div class="image-cropper-image-container">
+ <img ref="img" :src="dataUrl" alt="" @load.stop="createCropper" />
+ </div>
+ <div class="image-cropper-buttons-wrapper">
+ <button class="btn" type="button" :disabled="submitting" @click="submit" v-text="saveText"></button>
+ <button class="btn" type="button" :disabled="submitting" @click="destroy" v-text="cancelText"></button>
+ <i class="icon-spin4 animate-spin" v-if="submitting"></i>
+ </div>
+ <div class="alert error" v-if="submitError">
+ {{submitErrorMsg}}
+ <i class="button-icon icon-cancel" @click="clearError"></i>
+ </div>
+ </div>
+ <input ref="input" type="file" class="image-cropper-img-input" :accept="mimes">
+ </div>
+</template>
+
+<script src="./image_cropper.js"></script>
+
+<style lang="scss">
+.image-cropper {
+ &-img-input {
+ display: none;
+ }
+
+ &-image-container {
+ position: relative;
+
+ img {
+ display: block;
+ max-width: 100%;
+ }
+ }
+
+ &-buttons-wrapper {
+ margin-top: 15px;
+ }
+}
+</style>