funkwhale/front/src/components/library/TrackEdit.vue

85 wiersze
1.8 KiB
Vue
Czysty Zwykły widok Historia

<template>
<section class="ui vertical stripe segment">
<div class="ui text container">
<h2>
2021-12-06 10:35:20 +00:00
<translate
v-if="canEdit"
key="1"
translate-context="Content/*/Title"
>
Edit this track
</translate>
<translate
v-else
key="2"
translate-context="Content/*/Title"
>
Suggest an edit on this track
</translate>
</h2>
2021-12-06 10:35:20 +00:00
<div
v-if="!object.is_local"
class="ui message"
>
<translate translate-context="Content/*/Message">
This object is managed by another server, you cannot edit it.
</translate>
2019-04-11 08:17:10 +00:00
</div>
<edit-form
2019-04-11 08:17:10 +00:00
v-else-if="!isLoadingLicenses"
:object-type="objectType"
:object="object"
:can-edit="canEdit"
2021-12-06 10:35:20 +00:00
:licenses="licenses"
/>
<div
v-else
class="ui inverted active dimmer"
>
<div class="ui loader" />
</div>
</div>
</section>
</template>
<script>
2021-12-06 10:35:20 +00:00
import axios from 'axios'
import EditForm from '@/components/library/EditForm'
export default {
2021-12-06 10:35:20 +00:00
components: {
EditForm
},
props: {
objectType: { type: String, required: true },
object: { type: Object, required: true },
2021-12-08 18:48:06 +00:00
libraries: { type: Array, default: null }
2021-12-06 10:35:20 +00:00
},
data () {
return {
id: this.object.id,
isLoadingLicenses: false,
licenses: []
}
},
2021-12-06 10:35:20 +00:00
computed: {
canEdit () {
return true
}
},
created () {
this.fetchLicenses()
},
methods: {
fetchLicenses () {
2021-12-06 10:35:20 +00:00
const self = this
self.isLoadingLicenses = true
axios.get('licenses/').then((response) => {
self.isLoadingLicenses = false
self.licenses = response.data.results
})
}
}
}
</script>