funkwhale/front/src/components/channels/UploadMetadataForm.vue

93 wiersze
2.1 KiB
Vue
Czysty Zwykły widok Historia

<template>
<div :class="['ui', {loading: isLoading}, 'form']">
<div class="ui required field">
<label for="upload-title">
<translate translate-context="*/*/*/Noun">Title</translate>
</label>
2021-12-06 10:35:20 +00:00
<input
v-model="newValues.title"
type="text"
>
</div>
<attachment-input
v-model="newValues.cover"
:required="false"
2021-12-06 10:35:20 +00:00
@delete="newValues.cover = null"
>
<translate
slot="label"
translate-context="Content/Channel/*"
>
Track Picture
</translate>
</attachment-input>
2021-12-06 10:35:20 +00:00
<div class="ui small hidden divider" />
<div class="ui two fields">
<div class="ui field">
<label for="upload-tags">
<translate translate-context="*/*/*/Noun">Tags</translate>
</label>
<tags-selector
id="upload-tags"
2021-12-06 10:35:20 +00:00
v-model="newValues.tags"
:required="false"
/>
</div>
<div class="ui field">
<label for="upload-position">
<translate translate-context="*/*/*/Short, Noun">Position</translate>
</label>
2021-12-06 10:35:20 +00:00
<input
v-model="newValues.position"
type="number"
min="1"
step="1"
>
</div>
</div>
<div class="ui field">
<label for="upload-description">
<translate translate-context="*/*/*">Description</translate>
</label>
2021-12-06 10:35:20 +00:00
<content-form
v-model="newValues.description"
field-id="upload-description"
/>
</div>
</div>
</template>
<script>
2022-02-21 16:27:00 +00:00
import TagsSelector from '@/components/library/TagsSelector.vue'
import AttachmentInput from '@/components/common/AttachmentInput.vue'
export default {
components: {
TagsSelector,
AttachmentInput
},
2021-12-06 10:35:20 +00:00
props: {
upload: { type: Object, required: true },
values: { type: Object, required: true }
},
data () {
return {
2021-12-06 10:35:20 +00:00
newValues: { ...this.values } || this.upload.import_metadata
}
},
computed: {
2021-12-06 10:35:20 +00:00
isLoading () {
return !!this.metadata
}
},
watch: {
newValues: {
handler (v) {
this.$emit('values', v)
},
immediate: true
2021-12-06 10:35:20 +00:00
}
}
}
</script>