Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/assets/vue/mixins/ShowMixin.js

47 lines
1.1 KiB

import NotificationMixin from './NotificationMixin';
import { formatDateTime } from '../utils/dates';
export default {
mixins: [NotificationMixin],
created() {
this.retrieve(decodeURIComponent(this.$route.params.id));
},
computed: {
item() {
return this.find(decodeURIComponent(this.$route.params.id));
}
},
methods: {
list() {
this.$router
.push({ name: `${this.$options.servicePrefix}List` })
.catch(() => {});
},
del() {
this.deleteItem(this.item).then(() => {
this.showMessage(`${this.item['@id']} deleted.`);
this.$router
.push({ name: `${this.$options.servicePrefix}List` })
.catch(() => {});
});
},
formatDateTime,
editHandler() {
this.$router.push({
name: `${this.$options.servicePrefix}Update`,
params: { id: this.item['@id'] }
});
}
},
watch: {
error(message) {
message && this.showError(message);
},
deleteError(message) {
message && this.showError(message);
}
},
beforeDestroy() {
this.reset();
}
};