Skip to content

Commit

Permalink
Merge pull request #1026 from rdmorganiser/create_with_uri_path
Browse files Browse the repository at this point in the history
Add uri_path to factories
  • Loading branch information
jochenklar authored Jul 3, 2024
2 parents 7208136 + cb79c37 commit b5a46ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions rdmo/management/assets/js/factories/OptionsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] : [],
Expand Down
8 changes: 8 additions & 0 deletions rdmo/management/assets/js/factories/QuestionsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] : [],
Expand All @@ -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: [],
Expand All @@ -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: [],
Expand All @@ -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] : [],
Expand Down

0 comments on commit b5a46ba

Please sign in to comment.