2022-08-30 21:26:52 +08:00
|
|
|
/* global HelperModule */
|
|
|
|
|
|
|
|
export default {
|
|
|
|
methods: {
|
|
|
|
duplicateElement() {
|
2024-04-17 17:20:58 +08:00
|
|
|
this.$emit('component:adding-content', true);
|
2022-08-30 21:26:52 +08:00
|
|
|
$.post(this.element.attributes.orderable.urls.duplicate_url, (result) => {
|
|
|
|
this.$emit('component:insert', result.data);
|
|
|
|
HelperModule.flashAlertMsg(this.i18n.t('protocols.steps.component_duplicated'), 'success');
|
2023-08-09 16:33:58 +08:00
|
|
|
}).fail(() => {
|
2022-08-30 21:26:52 +08:00
|
|
|
HelperModule.flashAlertMsg(this.i18n.t('protocols.steps.component_duplication_failed'), 'danger');
|
2024-04-17 17:20:58 +08:00
|
|
|
}).always(() => {
|
|
|
|
this.$emit('component:adding-content', false);
|
2022-08-30 21:26:52 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|