From 884fe58525ed6aa18b3131d0cd842f1d2efced71 Mon Sep 17 00:00:00 2001 From: Andrej Date: Mon, 3 Oct 2022 17:16:50 +0200 Subject: [PATCH] Fix label print open issue [SCI-7296] --- .../packs/vue/repository_print_modal.js | 56 +++++++++---------- app/views/my_modules/protocols.html.erb | 1 - 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/app/javascript/packs/vue/repository_print_modal.js b/app/javascript/packs/vue/repository_print_modal.js index a470341b0..db9df2389 100644 --- a/app/javascript/packs/vue/repository_print_modal.js +++ b/app/javascript/packs/vue/repository_print_modal.js @@ -7,37 +7,35 @@ Vue.prototype.i18n = window.I18n; function initPrintModalComponent() { const container = $('.print-label-modal-container'); - if (!window.PrintModalComponent && container.length) { - window.PrintModalComponent = new Vue({ - el: '.print-label-modal-container', - name: 'PrintModalComponent', - components: { - 'print-modal-container': PrintModalContainer - }, - data() { - return { - showModal: false, - row_ids: [], - zebraEnabled: container.data('zebra-enabled'), - urls: { - print: container.data('print-url'), - zebraProgress: container.data('zebra-progress-url'), - printers: container.data('printers-url'), - labelTemplates: container.data('label-templates-url'), - rows: container.data('rows-url'), - fluicsInfo: container.data('fluics-info-url'), - printValidation: container.data('print-validation-url'), - labelPreview: container.data('label-preview-url') - } - }; - }, - methods: { - closeModal() { - this.showModal = false; + window.PrintModalComponent = new Vue({ + el: '.print-label-modal-container', + name: 'PrintModalComponent', + components: { + 'print-modal-container': PrintModalContainer + }, + data() { + return { + showModal: false, + row_ids: [], + zebraEnabled: container.data('zebra-enabled'), + urls: { + print: container.data('print-url'), + zebraProgress: container.data('zebra-progress-url'), + printers: container.data('printers-url'), + labelTemplates: container.data('label-templates-url'), + rows: container.data('rows-url'), + fluicsInfo: container.data('fluics-info-url'), + printValidation: container.data('print-validation-url'), + labelPreview: container.data('label-preview-url') } + }; + }, + methods: { + closeModal() { + this.showModal = false; } - }); - } + } + }); } initPrintModalComponent(); diff --git a/app/views/my_modules/protocols.html.erb b/app/views/my_modules/protocols.html.erb index 8f1c3cb0d..06b7f1681 100644 --- a/app/views/my_modules/protocols.html.erb +++ b/app/views/my_modules/protocols.html.erb @@ -177,5 +177,4 @@ <%= stylesheet_pack_tag 'pdfjs/pdf_js_styles' %> <%= javascript_pack_tag 'vue/protocol' %> -<%= render partial: 'label_printers/label_printer_modal' %>