6fdd4a2996
- Devise auth tokens are reset on password update - Avatar attachment file type is limited to jpeg,gif and png - Avatar attachment file size is limited to 15 mb - Widget Message attachments are limited to types ['image/png', 'image/jpeg', 'image/gif', 'image/bmp', 'image/tiff', 'application/pdf', 'audio/mpeg', 'video/mp4', 'audio/ogg', 'text/csv'] - Widget Message attachments are limited to 40Mb size limit.
71 lines
1.3 KiB
Vue
71 lines
1.3 KiB
Vue
<template>
|
|
<div>
|
|
<label>
|
|
<span v-if="label">{{ label }}</span>
|
|
</label>
|
|
<woot-thumbnail v-if="src" size="80px" :src="src" />
|
|
<div v-if="src && deleteAvatar" class="avatar-delete-btn">
|
|
<woot-button
|
|
color-scheme="alert"
|
|
variant="hollow"
|
|
size="tiny"
|
|
@click="onAvatarDelete"
|
|
>{{
|
|
this.$t('INBOX_MGMT.DELETE.AVATAR_DELETE_BUTTON_TEXT')
|
|
}}</woot-button
|
|
>
|
|
</div>
|
|
<label>
|
|
<input
|
|
id="file"
|
|
ref="file"
|
|
type="file"
|
|
accept="image/png, image/jpeg, image/gif"
|
|
@change="handleImageUpload"
|
|
/>
|
|
<slot></slot>
|
|
</label>
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
label: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
src: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
deleteAvatar: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
watch: {},
|
|
methods: {
|
|
handleImageUpload(event) {
|
|
const [file] = event.target.files;
|
|
|
|
this.$emit('change', {
|
|
file,
|
|
url: URL.createObjectURL(file),
|
|
});
|
|
},
|
|
onAvatarDelete() {
|
|
this.$refs.file.value = null;
|
|
this.$emit('onAvatarDelete');
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.avatar-delete-btn {
|
|
margin-top: var(--space-smaller);
|
|
margin-bottom: var(--space-smaller);
|
|
}
|
|
</style>
|