From 171ffab9a6c9136dce6d637aac7e066b4705c288 Mon Sep 17 00:00:00 2001 From: Jochen Klar Date: Fri, 21 Jun 2024 17:30:43 +0200 Subject: [PATCH 1/2] Add uri_path to factories --- rdmo/management/assets/js/factories/OptionsFactory.js | 1 + rdmo/management/assets/js/factories/QuestionsFactory.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/rdmo/management/assets/js/factories/OptionsFactory.js b/rdmo/management/assets/js/factories/OptionsFactory.js index a0b6436193..2d82ca73cb 100644 --- a/rdmo/management/assets/js/factories/OptionsFactory.js +++ b/rdmo/management/assets/js/factories/OptionsFactory.js @@ -13,6 +13,7 @@ class OptionsFactory { return { model: 'options.option', uri_prefix: config.settings.default_uri_prefix, + uri_path: parent.optionset ? `${parent.optionset.uri_path}/`: '', optionsets: parent.optionset ? [parent.optionset.id] : [], conditions: [], editors: config.settings.multisite ? [config.currentSite.id] : [], diff --git a/rdmo/management/assets/js/factories/QuestionsFactory.js b/rdmo/management/assets/js/factories/QuestionsFactory.js index bb8d6a47f6..a0c14559f9 100644 --- a/rdmo/management/assets/js/factories/QuestionsFactory.js +++ b/rdmo/management/assets/js/factories/QuestionsFactory.js @@ -15,6 +15,7 @@ class QuestionsFactory { return { model: 'questions.section', uri_prefix: config.settings.default_uri_prefix, + uri_path: parent.catalog ? `${parent.catalog.uri_path}/`: '', catalogs: parent.catalog ? [parent.catalog.id] : [], pages: [], editors: config.settings.multisite ? [config.currentSite.id] : [], @@ -25,6 +26,7 @@ class QuestionsFactory { return { model: 'questions.page', uri_prefix: config.settings.default_uri_prefix, + uri_path: parent.section ? `${parent.section.uri_path}/`: '', sections: parent.section ? [parent.section.id] : [], questionsets: [], questions: [], @@ -36,6 +38,9 @@ class QuestionsFactory { return { model: 'questions.questionset', uri_prefix: config.settings.default_uri_prefix, + uri_path: parent.page ? `${parent.page.uri_path}/`: ( + parent.questionset ? `${parent.questionset.uri_path}/`: '' + ), pages: parent.page ? [parent.page.id] : [], parents: parent.questionset ? [parent.questionset.id] : [], questionsets: [], @@ -48,6 +53,9 @@ class QuestionsFactory { return { model: 'questions.question', uri_prefix: config.settings.default_uri_prefix, + uri_path: parent.page ? `${parent.page.uri_path}/`: ( + parent.questionset ? `${parent.questionset.uri_path}/`: '' + ), widget_type: 'text', value_type: 'text', pages: parent.page ? [parent.page.id] : [], From cb79c377f6bfce85eae9cc18f7b15c60f5e4ee2d Mon Sep 17 00:00:00 2001 From: Jochen Klar Date: Tue, 2 Jul 2024 15:56:23 +0200 Subject: [PATCH 2/2] Remove / from uri_path in factories --- .../management/assets/js/factories/OptionsFactory.js | 2 +- .../assets/js/factories/QuestionsFactory.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rdmo/management/assets/js/factories/OptionsFactory.js b/rdmo/management/assets/js/factories/OptionsFactory.js index 2d82ca73cb..50bb461e4e 100644 --- a/rdmo/management/assets/js/factories/OptionsFactory.js +++ b/rdmo/management/assets/js/factories/OptionsFactory.js @@ -13,7 +13,7 @@ class OptionsFactory { return { model: 'options.option', uri_prefix: config.settings.default_uri_prefix, - uri_path: parent.optionset ? `${parent.optionset.uri_path}/`: '', + uri_path: parent.optionset ? parent.optionset.uri_path : '', optionsets: parent.optionset ? [parent.optionset.id] : [], conditions: [], editors: config.settings.multisite ? [config.currentSite.id] : [], diff --git a/rdmo/management/assets/js/factories/QuestionsFactory.js b/rdmo/management/assets/js/factories/QuestionsFactory.js index a0c14559f9..47547f6af6 100644 --- a/rdmo/management/assets/js/factories/QuestionsFactory.js +++ b/rdmo/management/assets/js/factories/QuestionsFactory.js @@ -15,7 +15,7 @@ class QuestionsFactory { return { model: 'questions.section', uri_prefix: config.settings.default_uri_prefix, - uri_path: parent.catalog ? `${parent.catalog.uri_path}/`: '', + uri_path: parent.catalog ? parent.catalog.uri_path : '', catalogs: parent.catalog ? [parent.catalog.id] : [], pages: [], editors: config.settings.multisite ? [config.currentSite.id] : [], @@ -26,7 +26,7 @@ class QuestionsFactory { return { model: 'questions.page', uri_prefix: config.settings.default_uri_prefix, - uri_path: parent.section ? `${parent.section.uri_path}/`: '', + uri_path: parent.section ? parent.section.uri_path : '', sections: parent.section ? [parent.section.id] : [], questionsets: [], questions: [], @@ -38,8 +38,8 @@ class QuestionsFactory { return { model: 'questions.questionset', uri_prefix: config.settings.default_uri_prefix, - uri_path: parent.page ? `${parent.page.uri_path}/`: ( - parent.questionset ? `${parent.questionset.uri_path}/`: '' + uri_path: parent.page ? parent.page.uri_path : ( + parent.questionset ? parent.questionset.uri_path : '' ), pages: parent.page ? [parent.page.id] : [], parents: parent.questionset ? [parent.questionset.id] : [], @@ -53,8 +53,8 @@ class QuestionsFactory { return { model: 'questions.question', uri_prefix: config.settings.default_uri_prefix, - uri_path: parent.page ? `${parent.page.uri_path}/`: ( - parent.questionset ? `${parent.questionset.uri_path}/`: '' + uri_path: parent.page ? parent.page.uri_path : ( + parent.questionset ? parent.questionset.uri_path : '' ), widget_type: 'text', value_type: 'text',