diff --git a/plugins/pubIds/urn/URNPubIdPlugin.php b/plugins/pubIds/urn/URNPubIdPlugin.php index b667878cb65..3080fef68b1 100755 --- a/plugins/pubIds/urn/URNPubIdPlugin.php +++ b/plugins/pubIds/urn/URNPubIdPlugin.php @@ -345,10 +345,6 @@ public function addPublicationFormFields(string $hookName, FormComponent $form): $appyCheckNumber = $this->getSetting($form->submissionContext->getId(), 'urnCheckNo'); - if ($appyCheckNumber) { - // Load the checkNumber.js file that is required for URN fields - $this->addJavaScript(Application::get()->getRequest(), TemplateManager::getManager(Application::get()->getRequest())); - } // If a pattern exists, use a DOI-like field to generate the URN if ($pattern) { $fieldData = [ @@ -470,12 +466,20 @@ public function loadUrnFieldComponent(string $hookName, array $args): void $templateMgr = $args[0]; $template = $args[1]; - if ($template !== 'workflow/workflow.tpl') { + if ($template !== 'dashboard/editors.tpl') { return; } $context = Application::get()->getRequest()->getContext(); $suffixType = $this->getSetting($context->getId(), 'urnSuffix'); + + $appyCheckNumber = $this->getSetting($context->getId(), 'urnCheckNo'); + + if ($appyCheckNumber) { + // Load the checkNumber.js file that is required for URN fields + $this->addJavaScript(Application::get()->getRequest(), TemplateManager::getManager(Application::get()->getRequest())); + } + if ($suffixType === 'default' || $suffixType === 'pattern') { $templateMgr->addJavaScript( 'field-pub-id-urn-component', diff --git a/plugins/pubIds/urn/js/FieldPubIdUrn.js b/plugins/pubIds/urn/js/FieldPubIdUrn.js index 2bb0a45b38c..f86e5cff517 100644 --- a/plugins/pubIds/urn/js/FieldPubIdUrn.js +++ b/plugins/pubIds/urn/js/FieldPubIdUrn.js @@ -11,9 +11,9 @@ * @brief A Vue.js component for URN field, that is used for pattern suffixes and that considers check number. */ -pkp.Vue.component('field-pub-id-urn', { +pkp.registry.registerComponent('FieldPubIdUrn', { name: 'FieldPubIdUrn', - extends: pkp.Vue.component('field-pub-id'), + extends: pkp.registry.getComponent('PkpFieldPubId'), props: { applyCheckNumber: { type: Boolean, @@ -22,10 +22,10 @@ pkp.Vue.component('field-pub-id-urn', { }, methods: { generateId() { - var id = pkp.Vue.component('field-pub-id').options.methods['generateId'].apply(this); + var id = pkp.registry.getComponent('PkpFieldPubId').methods['generateId'].apply(this); return this.applyCheckNumber ? id + $.pkp.plugins.generic.urn.getCheckNumber(id, this.prefix) : id; } }, -}); \ No newline at end of file +}) diff --git a/plugins/pubIds/urn/js/FieldTextUrn.js b/plugins/pubIds/urn/js/FieldTextUrn.js index f7625f4cfdb..dd45e673261 100644 --- a/plugins/pubIds/urn/js/FieldTextUrn.js +++ b/plugins/pubIds/urn/js/FieldTextUrn.js @@ -10,76 +10,77 @@ * * @brief A Vue.js component for URN text form field, that is used for custom suffixes, and that considers adding a check number. */ -var template = pkp.Vue.compile('