diff --git a/app/controllers/step_orderable_elements_controller.rb b/app/controllers/step_orderable_elements_controller.rb index eae9ee97e..d6ad48c41 100644 --- a/app/controllers/step_orderable_elements_controller.rb +++ b/app/controllers/step_orderable_elements_controller.rb @@ -2,7 +2,7 @@ class StepOrderableElementsController < ApplicationController before_action :load_vars_nested - before_action :load_vars + before_action :load_vars, only: :destroy before_action :check_manage_permissions, only: %i(create destroy) def create diff --git a/app/javascript/vue/protocol/mixins/components/delete.js b/app/javascript/vue/protocol/mixins/components/delete.js index 554277ffd..735a0eeae 100644 --- a/app/javascript/vue/protocol/mixins/components/delete.js +++ b/app/javascript/vue/protocol/mixins/components/delete.js @@ -1,11 +1,15 @@ export default { + data() { + return { + confirmingDelete: false + }; + }, methods: { showDeleteModal() { - $('#modalDestroyProtocolContent').modal('show'); - $('#modalDestroyProtocolContent .delete-step').off().one('click', () => { - this.deleteComponent(); - $('#modalDestroyProtocolContent').modal('hide'); - }); + this.confirmingDelete = true; + }, + closeDeleteModal() { + this.confirmingDelete = false; }, deleteComponent() { $.ajax({ diff --git a/app/javascript/vue/protocol/modals.vue b/app/javascript/vue/protocol/modals.vue index 14b237a53..0d5339491 100644 --- a/app/javascript/vue/protocol/modals.vue +++ b/app/javascript/vue/protocol/modals.vue @@ -1,6 +1,5 @@ diff --git a/app/javascript/vue/protocol/step.vue b/app/javascript/vue/protocol/step.vue index b211489b5..a09071b91 100644 --- a/app/javascript/vue/protocol/step.vue +++ b/app/javascript/vue/protocol/step.vue @@ -109,10 +109,10 @@ }, changeState() { this.step.attributes.completed = !this.step.attributes.completed; - this.$emit('step:update', this.step) + this.$emit('step:update', this.step.attributes) $.post(this.step.attributes.urls.state_url, {completed: this.step.attributes.completed}).error(() => { this.step.attributes.completed = !this.step.attributes.completed; - this.$emit('step:update', this.step) + this.$emit('step:update', this.step.attributes) HelperModule.flashAlertMsg(this.i18n.t('errors.general'), 'danger'); }) }, diff --git a/app/javascript/vue/protocol/step_components/checklist.vue b/app/javascript/vue/protocol/step_components/checklist.vue index 4f5591d4e..6ba347d92 100644 --- a/app/javascript/vue/protocol/step_components/checklist.vue +++ b/app/javascript/vue/protocol/step_components/checklist.vue @@ -4,13 +4,17 @@ +