scinote-web/app/javascript/vue/shared/content/mixins/move.js

25 lines
593 B
JavaScript

import axios from '../../../../packs/custom_axios.js';
export default {
data() {
return {
movingElement: false
};
},
methods: {
showMoveModal(event) {
event.stopPropagation();
this.movingElement = true;
},
closeMoveModal() {
this.movingElement = false;
},
moveElement(target_id) {
axios.post(this.element.attributes.orderable.urls.move_url, { target_id: target_id }).
then(() => {
this.movingElement = false;
this.$emit('moved', this.element.attributes.position, target_id);
});
}
}
};